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
26 changes: 23 additions & 3 deletions starter-code/basic-algorithms.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
// Names and Input
var hacker1 = "Jamilet"; //driver
console.log("The Driver's name is: " + hacker1);
var hacker2 = prompt("What is the Navigator's name?"); //navigator
console.log("The Navigator's name is: " + hacker2);


//Conditionals
if (hacker1.length > hacker2.length) {
console.log("The Driver has the longest name, it has " + hacker1.length + " characters" );
} else if (hacker1.length < hacker2.length) {
console.log("Yo, the Navigator got the longest name, it has " + hacker2.length + " characters");
} else {
console.log("Wow, you both got equally long names, " + hacker1.length + " characters");
}

var test = hacker1.toUpperCase("");
console.log(test.split('').join(' '));

// Lorem ipsum generator
var test2 = hacker2.split('').reverse('');
console.log(test2.join(''));

if (hacker1 > hacker2){
console.log("Yo, the navigator goes first definitely");
} else if (hacker1 < hacker2) {
console.log("The driver's name goes first");
} else {
console.log("What?! You both got the same name?");
}