Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions js/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
// Iteration 1: Names and Input

console.log("I'm Ready!")
let hacker1 = "Johnny";
console.log(`The driver's name is ${hacker1}`);
let hacker2 = "Kiyo";
console.log(`The navigator's name is ${hacker2}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! No comments on this iteration

// Iteration 2: Conditionals
if (hacker1.length === hacker2.length) {
console.log(`Wow, you both have equally long names, ${hacker1.length} characters!`);
} else if (hacker1.length > hacker2.length) {
console.log(`The driver has the longest name. It has ${hacker1.length} characters.`);
} else {
console.log(`It seems that the navigator has the longest name, it has ${hacker2.length} characters.`);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job as well here! All good
On a small note, on the conditionals, try to leave the else condition for the "===" in this case, and the other if statements for the "<" and ">" options. As I said the code is still good but it could be more readable for other partners the other way.

// Iteration 3: Loops
let driverNameCaps = ""

for (let i = 0; i < hacker1.length; i++) {
driverNameCaps += hacker1[i].toUpperCase() + " "
}
console.log(driverNameCaps);

let navNameReverse = ""

for (let i = hacker2.length - 1; i >= 0; i--) {
navNameReverse += hacker2[i]
}

console.log(navNameReverse);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good in this iteration!
No comments :D

// Iteration 3: Loops
if (hacker1.localeCompare(hacker2)) {
console.log("The driver's name goes first.")
} else if (hacker.localeCompare(hacker1)) {
console.log("Yo, the navigator goes first definitely.");
} else {
console.log("What?! You both have the same name?");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good as well here!
No comments! :D