Its simple and easy.. just write a function and match for regex and return the output like below
function:
function getVowels(str) {
var m = str.match(/[aeiou]/gi);
return m === null ? 0 : m.length;
}
getVowels("Anshul"); //output --> 2
getVowels("TRY"); //output --> 0
getVowels("AEIOU"); //output --> 5