The shortest I was able to come up with was:
function hasThreeVowels(value) {
const vowels = 'aeiou';
return [...value].filter(e => vowels.indexOf(e.toLowerCase()) > -1).length >= 3;
}
To break it down:
[...value]
takes the string value and creates an array populated with all the characters.
.filter(e => vowels.indexOf(e.toLowerCase()) > -1)
Then takes the array of characters and only includes those which exist within the
vowels
string (case-insensitive).
.length >= 3
Then checks whether the resulting array is greater-than-or-equal to three, which is the point of the function.