- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path17_switch_statement.js
More file actions
Latest commit
41 lines (37 loc) · 695 Bytes
/
Copy path17_switch_statement.js
File metadata and controls
41 lines (37 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Switch
// dice values 1 - 6
constdice=0;
switch(dice){
case0:
console.log('you got zero');
break;
case1:
console.log('you got one');
break;
case2:
console.log('you got two');
break;
case3:
console.log('you got three');
break;
case4:
console.log('you got four');
break;
case5:
console.log('you got five');
break;
// will print if dice = 0;
default:
console.log('not in option');
}
// all if
// const dice = 0;
// if (dice === 1) {
// console.log('you got one');
// }
// if (dice === 2) {
// console.log('you got two');
// }
// if (dice < 1 || dice > 6) {
// console.log("you didn't roll the dice");
// }