-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Dorota and Parina lab day-3 #499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
// Iteration 2: Conditionals | ||
|
||
function theLongestName(name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be careful with the parameters, but I guess that now you understood ;)
if (hacker1.length > hacker2.length) { | ||
return "The Driver has the longest name, it has " + hacker1.length + " characters" | ||
} else if (hacker1.length < hacker2.length) { | ||
return "Yo, navigator got the longest name, it has " + hacker2.length + " characters" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you are only comparing the first letter and not the whole word, use a loop instead to parse each letter of the word!
function reverseString(str) { | ||
let upperCasedFirstLetter = hacker2.slice(0, 1).toUpperCase(); | ||
console.log(upperCasedFirstLetter) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your 2 first variable are useless... you are not calling them later.
But good job for the revers + join !
var alphaName = array1.sort(); | ||
if (hacker1.slice(0, 1) < hacker2.slice(0, 1)) { | ||
return "The driver's name goes first." | ||
} else if (hacker1.slice(0, 1) > hacker2.slice(0, 1)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment for the parameters...
if (input == null || input.length == 0) { | ||
return 0; | ||
} | ||
var words = input.split(" "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job, super efficient!
Follow my advices and next time it would be perfect ;) |
Hi,
could you confirm everything works?
Thanks