Skip to content

paris-christian-jeannicolas#230

Closed
blksnk wants to merge 1 commit into
ironhack-labs:masterfrom
blksnk:master
Closed

paris-christian-jeannicolas#230
blksnk wants to merge 1 commit into
ironhack-labs:masterfrom
blksnk:master

Conversation

@blksnk
Copy link
Copy Markdown

@blksnk blksnk commented Oct 15, 2018

@blksnk blksnk changed the title paris-chrisitan-jeannicolas paris-christian-jeannicolas Oct 15, 2018
var str2;
for (var i = 0; i <= (hacker2.length - 1); i++) {
str2 += hacker2[i];
};
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This for loop is not really needed, it is the same thing of doing :

var str2 = hacker2;

@ta-web-paris
Copy link
Copy Markdown

Good job !! Conditions, loops and string methods seem well understood !
Keep up the good work ! 👍

}
else {
console.log("What?! You both got the same 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.

In the first big if statement, to check if they have the same name, you are only comparing the first letter of each name. To be sure your code also works if there names start with the same letter but have different names, you can write your code like that :

if (hacker1 === hacker2){
  console.log("What?! You both got the same name?");
} else if (names[0] === hacker1) {
    console.log("The driver's name goes first");
}  else  {
    console.log("Yo, the navigator goes first definitely");
} 

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