-
Notifications
You must be signed in to change notification settings - Fork 5.8k
BCN - Selim Lebbady #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, you did more than you were asked for because you used a more complicated way to solve the problem!
No description provided.