Skip to content

Dorota and Parina lab day-3#499

Closed
ParinaKh wants to merge 2 commits into
ironhack-labs:masterfrom
ParinaKh:master
Closed

Dorota and Parina lab day-3#499
ParinaKh wants to merge 2 commits into
ironhack-labs:masterfrom
ParinaKh:master

Conversation

@ParinaKh
Copy link
Copy Markdown

Hi,

could you confirm everything works?

Thanks


// Iteration 2: Conditionals

function theLongestName(name) {
Copy link
Copy Markdown

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"
Copy link
Copy Markdown

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)

Copy link
Copy Markdown

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)) {
Copy link
Copy Markdown

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(" ");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

great job, super efficient!

@ta-web-paris
Copy link
Copy Markdown

Follow my advices and next time it would be perfect ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants