Way One:
function endsWithVowel(str) {
let reg=/(a|o|i|o|u)$/gi;
return reg.test(str);
}
Way Two:
function endsWithVowel(str) {
return "aeiouAEIOU".indexOf(str[str.length-1])>-1;
}
Way One:
function endsWithVowel(str) {
let reg=/(a|o|i|o|u)$/gi;
return reg.test(str);
}
Way Two:
function endsWithVowel(str) {
return "aeiouAEIOU".indexOf(str[str.length-1])>-1;
}