Hello guys,
I want try other way to finish the whale talk. I try to finish it with .splice to learn how it work.
I have an issues, my code doesn’t work and I don’t understand why, can you help me?
let sentence = 'you are amazing';
let result = [];
for(let i = 0; i < sentence.length; i++){
if(sentence[i] === 'a' || sentence[i] === 'e' || sentence[i] === 'i' || sentence[i] === 'o' || sentence[i] === 'u'){
result.push(sentence[i]);
}
}
for(let y = 0; y < result.length; y++){
if(result[y] === 'u'){
result.splice(y,0,'u');
}
}
console.log(result);