Skip to content

PAR Luke & Renaud & Elise#82

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

PAR Luke & Renaud & Elise#82
lukegenoyer wants to merge 1 commit into
ironhack-labs:masterfrom
lukegenoyer:master

Conversation

@lukegenoyer
Copy link
Copy Markdown

@lukegenoyer lukegenoyer commented Mar 19, 2018

We are not sure about step 8...

@ta-web-paris
Copy link
Copy Markdown

ta-web-paris commented Mar 20, 2018

You can also use this method :

var n = hacker1.localeCompare(hacker2)

if (n < 0) { console.log("The driver's name goes first")}
else if (n > 0){console.log("The navigator's name goes first")}
else {console.log("Wow, you both have the same name!")}

It will compare two strings (hacker1 & hacker2) and it will return a number between 1 and -1, then you just have to check if it's greater, equal or lower.

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