File tree Expand file tree Collapse file tree 1 file changed +35
-1
lines changed Expand file tree Collapse file tree 1 file changed +35
-1
lines changed Original file line number Diff line number Diff line change 1
1
// Iteration 1: Names and Input
2
+ let hacker1 = "Stefan" ;
3
+ console . log ( `The driver's
4
+ name is ${ hacker1 } ` ) ;
2
5
6
+ let hacker2 = "Juan" ;
7
+ console . log ( "The navigator's name is " + hacker2 ) ;
3
8
4
9
// 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
+ }
5
23
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
+ }
6
40
7
- // Iteration 3: Loops
41
+ // Iteration 3: Loops
You can’t perform that action at this time.
0 commit comments