-
Notifications
You must be signed in to change notification settings - Fork 5.8k
BCN - Jack Watkins #264
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 - Jack Watkins #264
Conversation
@@ -1,7 +1,61 @@ | |||
'use strict'; |
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.
Niceeee!!!
var hacker1 = "dave"; | ||
console.log("the drivers name is " + hacker1); | ||
|
||
let hacker2 = "hello"; |
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.
Two things:
- try to keep your code consisten, you use everywhere var and here let...
- it isn't mandatory to declare the variable before and then change it. You can do :
var hacker2 = prompt('.....')
console.log('....' + hacker2)
var driverNameStart = hacker1[0]; | ||
var navigatorNameStart = hacker2[0]; | ||
var alpha1 = alphabet.indexOf(driverNameStart); | ||
var alpha2 = alphabet.indexOf(navigatorNameStart); |
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.
you are not using this var, maybe you can get rid of those.
console.log("Yo, the navigator goes first definitely"); | ||
} else{ | ||
console.log("What?! You both got the same 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.
You are not checking which hacker starts with the "smaller" letter. To do that you can use the variables that you created to check the first letter of each hacker and compare those.
if(driverNameStart > navigatorNameStart){
console.log("The driver's name goes first");
} ...
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, keep like this. Only one thing: pay attention to identation!!
No description provided.