Solución
solution.tsTypeScript
function countWordsStartingWithVowel(sentence: string): number {
const VOWELS = ['a', 'e', 'i', 'o', 'u']
if (sentence.trim().length <= 0) return 0
return sentence.split(" ").reduce((acc, value) => {
if (VOWELS.includes(value[0].toLocaleLowerCase())) return acc + 1
return acc
}, 0)
}
// No modificar: necesario para evaluar el resultado.
export { countWordsStartingWithVowel };0respuestas