Whale talk.. too different!

Usually when I do project on codecademy, I try not to see the order to do but just try it on my own.
This time I thought so differently that I went too far XD

const input = "My friend told me you're the whale!";
const vowels = ["a", "e", "i", "o", "u"];

//if input contains(includes) vowel[i], take only vowels from the input. =>
let result;

// to take each alphabet from input, use for...
// and store it to a new array (tempSave)
// with that array, compare with vowels array
// and save it to a new mutual array

console.log(`The vowels' array: [${vowels}]`);
// charAt(number) => separate input's alphabet
let tempSave = [];
const tempMutual = [];

for (let i = 0; i < input.length; i++) {
  tempSave.push(input.charAt(i));
}
console.log(`The input's array: [${tempSave}]`);

//compare vowels' array and input's array.
//and find the mutual vowels
for (let i = 0; i < tempSave.length; i++) {
  for (let j = 0; j < vowels.length; j++) {
    if (tempSave[i] === vowels[j]) {
      tempMutual.push(vowels[j]);
    }
  }
}
// mutual vowels found.
console.log(`The leftover vowels' array: [${tempMutual}]`);

//locate where the 'e' is
let indices = [];
let element = "e";
let idx = tempMutual.indexOf(element);
//Since indexOf only works single time, had to make up a loop to keep finding.
while (idx !== -1) {
  indices.push(idx);
  idx = tempMutual.indexOf(element, idx + 1);
}
// found the location of 'e'
console.log(indices);

//locate where the 'u' is
let indices1 = [];
let element1 = "u";
let idx1 = tempMutual.indexOf(element1);
//Since indexOf only works single time, had to make up a loop to keep finding.
while (idx1 !== -1) {
  indices1.push(idx1);
  idx1 = tempMutual.indexOf(element1, idx1 + 1);
}
// found the location of 'u'
console.log(indices1);

//change 'e' to 'ee'
for (let i = 0; i < indices.length; i++) {
  tempMutual.splice(indices[i], 1, "ee");
}
//change 'u' to 'uu'
for (let i = 0; i < indices1.length; i++) {
  tempMutual.splice(indices1[i], 1, "uu");
}
//console the final array
console.log(tempMutual);

//make the array string and make it uppercase.
result = tempMutual.join("").toUpperCase();

//log the result!
console.log(result);

Soooo what’s the error?

order definitely does matter in some cases, but it’ll be better here if you address the exact issue you’re facing.