Hi again,
Sorry to keep posting - I’m hoping I’ll get the hang of this soon!
So, I’ve completed all the instructions in Whale Talk and checked the accompanying video to see if I was coding correctly - it appears to me to be the same. However, my code is returning ‘A’, ‘I’, ‘O’ twice (when they should only be returned once, and the ‘E’ and ‘U’ thrice, when then they should be returned only twice. I have no idea why!!
let input = 'Hi, human';
const vowels = ['a', 'e', 'i', 'o', 'u'];
let resultArray = [];
for (let i = 0; i < input.length; i++) {
for (let j = 0; j < vowels.length; j++) {
console.log(j);
if (input[i] === vowels[j]) {
if(input[i] === 'e'){
resultArray.push('ee');
} else{
resultArray.push(input[i]);
}
if (input[i] === 'u'){
resultArray.push('uu');
} else{
resultArray.push(input[i]);
}
}
}
}
console.log(resultArray.join('').toUpperCase());