October 24th, 2024
What's missing in this code?
func('Just a simple example'); // Jus a simpe exampe
func('This is a tricky one'); // Thi i a trick oe
func('Programming is fun'); // Programmin i fu
func('How are you?'); // Ho ae you
function func(sentence) {
const vowels = 'aeiouAEIOU';
return sentence
.split(' ')
.map((word) => {
for (let i = word.length - 1; i
0; i--) {
if (!vowels.includes(word[i]))
return word.slice(
) + word.slice(
);
}
}
return word;
})
.join(' ');
}
Type or select from these options