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()
function countVowels(subject) { return subject.match(/[aeiou]/gi).length; }
You don't need to convert anything, Javascript's error handling is enough to hint you on such a simple function if it will be needed.