Find out the number of vowels for given string.

Question: Create a function that returns number of vowels from given string.

Answer:

function checkVowels(str) {

var regexp = /[a|e|i|o|u]/gi;

var matches_array = str.match(regexp);

return matches_array.length;

}

Try it Yourself: