Skip to content

Conversation

jackwatk
Copy link

No description provided.

@@ -1,7 +1,61 @@
'use strict';
Copy link
Contributor

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";
Copy link
Contributor

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);
Copy link
Contributor

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?");
}
Copy link
Contributor

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");
}  ...

Copy link
Contributor

@tawebbcn tawebbcn left a 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!!

@tawebbcn tawebbcn closed this Oct 23, 2018
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy