Skip to content

ING-Alina-Jürgen-Sergej#575

Closed
JueGooss wants to merge 4 commits into
ironhack-labs:masterfrom
JueGooss:master
Closed

ING-Alina-Jürgen-Sergej#575
JueGooss wants to merge 4 commits into
ironhack-labs:masterfrom
JueGooss:master

Conversation

@JueGooss
Copy link
Copy Markdown

First Iteration done

Comment thread index.js
/*Iteration 2: Conditionals
2.1. Depending on which name is longer, print: - The Driver has the longest name, it has XX characters or - Yo, navigator got the longest name, it has XX characters or - Wow, you both got equally long names, XX characters!*/

if (hacker1.length >=hacker2.length){
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be greatly simplified by extracting the condition as an expression to use in the if else branching

Comment thread index.js
} else {
console.log(`The Driver has the longest name, it has ${hacker1.length} characters`)
}
} else {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer an explicit condition. see above comment

Comment thread index.js

/*Iteration 3: Loops
3.1 Print all the characters of the driver's name, separated by a space and in capitals i.e. "J O H N"*/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer use of loops as per lesson instruction

Comment thread index.js
}
console.log(split);*/

let splittedName = uppercasedDriver.split("");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for native string methods prefer method concatenation

Comment thread index.js
//3.2 Print all the characters of the navigator's name, in reverse order. i.e. "nhoJ"//


let reversedName = hacker2.split("").reverse().join("")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer loops as per lesson instructions

Comment thread index.js

//3.3 Depending on the lexicographic order of the strings, print: - The driver's name goes first. - Yo, the navigator goes first definitely. - What?! You both got the same name?//

let abc = "abcdefghijklmnopqrstuvwxyz";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR: this is not the correct solution because it does not respect the lexicographic order

Comment thread index.js
if (hacker1.length >=hacker2.length){
if (hacker1.length == hacker2.length){
console.log(`Wow, you both got equally long names, ${hacker1.length} characters!`)
} else {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer explicit condition

Comment thread index.js
} else {
console.log(`The Driver has the longest name, it has ${hacker1.length} characters`)
}
} else {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer explicit condition

Copy link
Copy Markdown

@MarcoSantonastasi MarcoSantonastasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be cleaned up a bit.
If else branching particularly
Up to bonus 2

@stale
Copy link
Copy Markdown

stale Bot commented Dec 19, 2019

This pull request has been automatically marked as stale because it didn't have any recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the stale label Dec 19, 2019
@stale
Copy link
Copy Markdown

stale Bot commented Dec 21, 2019

This pull request is closed. Thank you.

@stale stale Bot closed this Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants