Skip to content

Commit a96081c

Browse files
committed
Solved lab
1 parent d31e68d commit a96081c

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"liveServer.settings.port": 5501
3+
}

index.js

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,37 @@
11
// Iteration 1: Names and Input
2-
2+
const hacker1 = "Gregory";
3+
console.log(`The driver's name is ${hacker1}`);
4+
const hacker2 = "Jennifer";
5+
console.log(`The navigator's name is ${hacker2}`);
36

47
// Iteration 2: Conditionals
58

9+
if (hacker1.length > hacker2.length) {
10+
console.log(`The driver has the longest name, it has ${hacker1.length} characters`);
11+
} else if (hacker1.length < hacker2.length) {
12+
console.log(`It seems that the navigator has the longest name, it has ${hacker2.length} characters.`)
13+
} else {
14+
console.log(`Wow, you both have equally long names, ${hacker1.length || hacker2.length} characters!`)
15+
}
616

717
// Iteration 3: Loops
18+
19+
const updatedHackerName1 = hacker1.split('').join(' ').toUpperCase();
20+
console.log(updatedHackerName1);
21+
22+
for (let i = hacker2.length -1; i >= 0; i--) {
23+
console.log(hacker2[i]);
24+
}
25+
26+
27+
if (hacker1[0] > hacker2[0]) {
28+
console.log("The driver's name goes first.");
29+
} else if (hacker1[0] < hacker2[0]) {
30+
console.log("Yo, the navigator goes first, definitely.")
31+
} else {
32+
console.log("What?! You both have the same name?")
33+
}
34+
35+
// BONUS 2
36+
37+

0 commit comments

Comments
 (0)