I\'m using basic JavaScript to count the number of vowels in a string. The below code works but I would like to have it cleaned up a bit. Would using .includes()
Function vowels(str){
let count=0;
const checker=['a','e','i','o','u'];
for (let char of str.toLowerCase){
if (checker.includes(char)){
count++;
}
return count;
}
Function vowels(str){
const match = str.match(/[aeiou]/gi);
return match ? match.length : 0 ;
}