• + 0 comments

    function getLetter(s) { let letter; let a = ["a","e","i","o","u"]; let b = ["b","c", "d", "f","g"]; let c = ["h", "j", "k", "l", "m"];

    //     // Write your code here
    // return a.includes(s[0])
    //     if(a.includes(s[0])){
    
    //    return "A"
    //     }else{
    //         return "no"
    
        // }
    let firstChar = s[0]
    

    switch (true) { case a.find(item => item === firstChar) !== undefined: letter = "A"; break; case b.includes(firstChar): letter = "B"; break; case c.includes(firstChar): letter = "C"; break; default: letter = "D"; }

    return letter;
    

    }

    commented code is for understanding