1function caseInSwitch(val) {
2 var answer = "";
3 // Only change code below this line
4switch(val) {
5 case 1:
6 answer = "alpha";
7 console.log(answer);
8 break;
9 case 2:
10 answer = "beta";
11 break;
12 case 3:
13 answer = "gamma";
14 break;
15 case 4:
16 answer = "delta";
17 break;
18}
19
20
21 // Only change code above this line
22 return answer;
23}
24
25caseInSwitch(1);
26
1function getLetter(s) {
2 let letter;
3 // Write your code here
4 switch (true) {
5 case "aeiou".includes(s[0]):
6 letter = "A";
7 break;
8 case "bcdefg".includes(s[0]):
9 letter = "B";
10 break;
11 case "hijklm".includes(s[0]):
12 letter = "C";
13 break;
14 case "nopqrstuvwxyz".includes(s[0]):
15 letter = "D";
16 break;
17 }
18 return letter;
19}
1switch (expression) {
2 case value1:
3 //Statements executed when the
4 //result of expression matches value1
5 [break;]
6 case value2:
7 //Statements executed when the
8 //result of expression matches value2
9 [break;]
10 ...
11 case valueN:
12 //Statements executed when the
13 //result of expression matches valueN
14 [break;]
15 [default:
16 //Statements executed when none of
17 //the values match the value of the expression
18 [break;]]
19}