Why don't you console.log inside the loop?
Thu Aug 25 2022 14:47:23 GMT+0000 (Coordinated Universal Time)
Saved by
@Carminos
// Only keep AEIOU. Double U and E
// Step 1: Create a variable equal to any phrase
const input = 'suffering succotash!';
// Step 2: Create an array of vowels
const vowels = ['a', 'e', 'i', 'o', 'u'];
// Step 3: Empty array
const resultArray = [];
// Step 4: Loop over input
for (let i = 0; i < input.length; i++){
// console.log(i)
for (let j = 0; j < vowels.length; j++){
// console.log(j)
if(input[i] === vowels[j]){
//console.log(input[i])
resultArray.push(input[i]);
console.log(resultArray);
}
}
}
content_copyCOPY
Comments