Check Vowel

Write a function that takes a character (i.e. a string of length 1) and returns true if it is a vowel, false otherwise.

by creativevilla

JavaScript

function chkVowel(vowel) {
    var len = vowel.length;
    vowel = vowel.toLowerCase();
    if(len > 1){
        return "Enter only 1 character";
    }
    if(vowel.match(/[aeiou]/)) {
        return true;
    }
    return false;
}

var t1 = chkVowel("a");
console.log(t1);