-1

I'm trying to create a function where it returns true if the word has a vowel.

function hasVowel(str) {
    lowerstr = str.toLowerCase()
    return lowerstr.includes("a" || "e" || "i" || "o" || "u")

}

console.log(hasVowel('dog')); // true
console.log(hasVowel('conventional')); // true
console.log(hasVowel('rhythm')); // false```

When you run this, it returns:
false (incorrect)
true
false

Does anyone know why this happens?

0 Answers0