You are viewing a single comment's thread. Return to all comments →
Here's my solution:
function getLetter(s) { let firstChar = s.charAt(0); let letter; switch (true) { case new Set(['a','e','i','o','u']).has(firstChar): letter = "A"; break; case new Set(['b','c','d','f','g']).has(firstChar): letter = "B"; break; case new Set(['h','j','k','l','m']).has(firstChar): letter = "C"; break; default: letter = "D"; } return letter; }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 2: Conditional Statements: Switch
You are viewing a single comment's thread. Return to all comments →
Here's my solution: