BCN - Selim Lebbady - #260
Conversation
|
|
||
| var driver = "John"; | ||
| console.log("The driver's name is ",driver); | ||
| let navigator = prompt("What's the navigator's name?"); |
There was a problem hiding this comment.
Try to make your code consistent and use always the same structure, in this case you used always var and here let.
| } | ||
| else { | ||
| console.log("Yo, the navigator goes first definitely"); | ||
| } |
There was a problem hiding this comment.
Amazing but there's an easier way. JS already knows the order so you can simplify your code only comparing the first two letters of the names and it will knows which goes first. Like that :
`
var hacker1Order = hacker1[0];
var hacker2Order = hacker2[0];
if (hacker1Order < hacker2Order) {
console.log('The driver's name goes first');
} etc....
`
| "y":25, | ||
| "z":26 | ||
| }; | ||
| debugger; |
There was a problem hiding this comment.
Try to clean your code once you've finished. But cool, you used the debugger!!
tawebbcn
left a comment
There was a problem hiding this comment.
Nice work, you did more than you were asked for because you used a more complicated way to solve the problem!
No description provided.