Skip to content

Commit 4d8b66f

Browse files
committed
first two iterations
1 parent 4f13452 commit 4d8b66f

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

js/index.js

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,41 @@
11
// Iteration 1: Names and Input
2+
let hacker1 = "Stefan";
3+
console.log(`The driver's
4+
name is ${hacker1}`);
25

6+
let hacker2 = "Juan";
7+
console.log("The navigator's name is " + hacker2);
38

49
// Iteration 2: Conditionals
10+
if (hacker1.length > hacker2.length) {
11+
console.log(
12+
`The driver has the longest name. It has ${hacker1.length} characters.`
13+
);
14+
} else if (hacker1.length < hacker2.length) {
15+
console.log(
16+
`It seems that the navigator has the longest name, it has ${hacker2.length} characters.`
17+
);
18+
} else {
19+
console.log(
20+
`Wow, you both have equally long names, ${hacker1.length} characters!`
21+
);
22+
}
523

24+
switch (true) {
25+
case hacker1.length > hacker2.length:
26+
console.log(
27+
`The driver has the longest name. It has ${hacker1.length} characters.`
28+
);
29+
break;
30+
case hacker1.length < hacker2.length:
31+
console.log(
32+
`It seems that the navigator has the longest name, it has ${hacker2.length} characters.`
33+
);
34+
break;
35+
default:
36+
console.log(
37+
`Wow, you both have equally long names, ${hacker1.length} characters!`
38+
);
39+
}
640

7-
// Iteration 3: Loops
41+
// Iteration 3: Loops

0 commit comments

Comments
 (0)