-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Johnny Burke, Kiyohide Hayashi - Berlin - W1D1 Lab #609
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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}`); | ||
|
|
||
| // 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.`); | ||
| } | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice job as well here! All good |
||
| // 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); | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All good in this iteration! |
||
| // 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?"); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All good as well here! |
||
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 job! No comments on this iteration