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

console.log("I'm Ready!");
var hacker1 = "Leo";
var hacker2 = prompt("What's your name?");
console.log("The driver's name is " + hacker1);
console.log("The navigator's name is " + hacker2);

//Conditionals

if (hacker2.length > hacker1.length) {
console.log("Yo, navigator got the longest name, it has " + hacker2.length + " characters");
} else if (hacker2.length === hacker1.length) {
console.log("wow, you both got equally long names, " + hacker1.length + " characters");
} else {
console.log("The driver has the longest name, it has " + hacker1.length + " characters");
}

// Lorem ipsum generator
var driverName = " ";

for (i=0; i<hacker1.length; i++) {
driverName += hacker1[i].toUpperCase() + " ";
}

console.log(driverName);

var navigatorName = " ";

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

console.log(navigatorName);
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy