Help with Whale Project Step 8

Hi, I will copy the question so you can see, but you have to Add two Objects to a Loop on this Question, meaning .push and stringName[i} I have done the .push part, but don’t know how to apply stringName. Can someone help me, does anyone have a link to the reading page for stringname[i] ?

My code and the Question Below;

const input = "I've no idea what to Say";

const vowles = ["a", "e", "i", "o", "u",];

let resultArray = [];

for(let inputIndex = 0; inputIndex < input.length; inputIndex++){
  //console.log("inputIndex = " + inputIndex);
for( let V2 = 0; V2 < vowles.length; V2++){
//console.log("Vowles is" + V2)
if (input[inputIndex] === vowles[V2]) {
resultArray.push(input[inputIndex]); 

I’m pretty sure you answered your own question.

Specifically:

input is “stringName” and inputIndex is “i” (as it represents the different index numbers in input).

If I may add a tiny suggestion on top of this:

See how I added toLowerCase() after input[inputIndex]? This will help you handle any vowels that are uppercase, without having to add the uppercase versions to vowles.

if (input[inputIndex].toLowerCase() === vowles[V2]) {
resultArray.push(input[inputIndex]); 

Thanks for getting back to me, that made sense it does appear like I have written the string already… but i can’t get the box to tick, thus I can’t move on to the next step?

const input = "I've no idea what to Say";

const vowles = ["a", "e", "i", "o", "u",];

let resultArray = [];

for(let inputIndex = 0; inputIndex < input.length; inputIndex++){
  //console.log("inputIndex = " + inputIndex);
for( let V2 = 0; V2 < vowles.length; V2++){
//console.log("Vowles is" + V2)
if (input[inputIndex].toLowerCase() === vowles[V2]) {
resultArray.push(input[inputIndex]); 

}
}
}

Hi ithomas123. In projects like “Whale Talk”, you mark the tasks as completed yourself, by checking them off.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.