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.
functiongetLetter(s){letletter;// Write your code hereconstdata={A:['a','e','i','o','u'],B:['b','c','d','f','g'],C:['h','j','k','l','m'],D:['n','p','q','r','s','t','v','w','x','y','z']}switch(s[0]){casedata.A.find(item=>(item===s[0])):letter='A';break;casedata.B.find(item=>(item===s[0])):letter='B';break;casedata.C.find(item=>(item===s[0])):letter='C';break;casedata.D.find(item=>(item===s[0])):letter='D';break;}returnletter;}
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 →
My solution