The second 'for' loop -Search Text for your Name


#1

var text ="Whitney sdfsdf Whitney dfs Whitney dsfsd Whitney sdfsdf Whitney Whitney Whitney Whitney run run run run run run"

var myName ="Whitney Whitney Whitney Whitney Whitney Whitney Whitney"

var hits=[]

for(i=0;text>=text.length;i++){
if(text[i] === 'W') {
for(var j = i; j <( i +myName.length); j++)
{
hits.push(text[j]);
}
}
}

I am at my end...Someone help please. I don't understand why it isn't working. Also please explain how exactly does this work?


#2

for(i=0;text>=text.length;i++){

Should be:

for(i=0;i


#3

It's still showing me this

Oops, try again. It looks like your second 'for' loop isn't pushing values to the hits array. Make sure it's working properly and that myName's text appears somewhere in the text variable.


#5

You didn't change it. This should be:

for (var i = 0; i < text.length; i++)