We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
function getLetter(s) {
let letter;
// Write your code here
let sOne = "aeiou";
let sTwo = "bcdfg";
let sThree = "hjklm";
switch(true){
case (sOne.search(s[0]) != -1):
letter = "A";
break;
case (sTwo.search(s[0]) != -1):
letter = "B";
break;
case (sThree.search(s[0]) != -1):
letter = "C";
break;
default:
letter = "D";
}
return letter;
}
Cookie support is required to access HackerRank
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 →
function getLetter(s) { let letter; // Write your code here let sOne = "aeiou"; let sTwo = "bcdfg"; let sThree = "hjklm";
}