Skip to content

BCN - Jack Watkins - #264

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

BCN - Jack Watkins#264
jackwatk wants to merge 1 commit into
ironhack-labs:masterfrom
jackwatk:master

Conversation

@jackwatk

Copy link
Copy Markdown

No description provided.

@@ -1,7 +1,61 @@
'use strict';

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

@tawebbcn tawebbcn left a comment

Copy link
Copy Markdown
Contributor

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