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()
.includes()
Just use this function [for ES5] :
function countVowels(str){ return (str.match(/[aeiou]/gi) == null) ? 0 : str.match(/[aeiou]/gi).length; }
Will work like a charm