Dorota and Parina lab day-3#499
Closed
ParinaKh wants to merge 2 commits into
Closed
Conversation
|
|
||
| // Iteration 2: Conditionals | ||
|
|
||
| function theLongestName(name) { |
There was a problem hiding this comment.
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.
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.
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.
Same comment for the parameters...
| if (input == null || input.length == 0) { | ||
| return 0; | ||
| } | ||
| var words = input.split(" "); |
|
Follow my advices and next time it would be perfect ;) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
could you confirm everything works?
Thanks