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
27 changes: 20 additions & 7 deletions starter-code/basic-algorithms.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
// Names and Input


//Conditionals


// Lorem ipsum generator
var hacker1 = "Ana";
var hacker2 = prompt ("What's the navigator's name?");
console.log("The driver's name is "+hacker1);
console.log("The navigator's name is "+hacker2);
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, navigator got the longest name, it has "+hacker2.length+" characters");
} else if (hacker1.length === hacker2.length){
console.log("Wow, you both got equally long names, "+hacker1.length+" characters!!");
} else {
console.log ("Error");
}
var output = "";
var letters = "";
for (var i = 0; i < hacker1.length; i++){
letters = hacker1[i].toUpperCase() + " ";
output += letters;
console.log(output);
}