Skip to content

Commit d7de999

Browse files
authored
Update Conditional_statement_switch.js
1 parent 3842f02 commit d7de999

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,46 @@
1+
'use strict';
12

3+
process.stdin.resume();
4+
process.stdin.setEncoding('utf-8');
5+
6+
let inputString = '';
7+
let currentLine = 0;
8+
9+
process.stdin.on('data', inputStdin => {
10+
inputString += inputStdin;
11+
});
12+
13+
process.stdin.on('end', _ => {
14+
inputString = inputString.trim().split('\n').map(string => {
15+
return string.trim();
16+
});
17+
18+
main();
19+
});
20+
21+
function readLine() {
22+
return inputString[currentLine++];
23+
}
24+
25+
function getLetter(s) {
26+
27+
switch(s.charAt(0))
28+
{
29+
case('a'||'e'||'i'||'o'||'u'):
30+
return 'A'
31+
case('b'||'c'||'d'||'f'||'g'):
32+
return 'B'
33+
case('h'||'j'||'k'||'l'||'m'):
34+
return 'C'
35+
case('z'||'n'||'p'||'q'||'r'||'s'||'t'||'v'||'w'||'x'||'y'):
36+
return 'D'
37+
38+
}
39+
}
40+
41+
42+
function main() {
43+
const s = readLine();
44+
45+
console.log(getLetter(s));
46+
}

0 commit comments

Comments
 (0)