Your second 'for' loop isn't pushing values to the hits array


#1

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.

this is the error that it says..
plz help i am unable to figure it out..

var text="how are you ash. i am ash. what you doing ash?";
var myName="ash";
var hits=[];
for(var i=0;i{
if(text[i]==="A")
{
for(var j=i;j< (myName.length+ i); j++)
{
hits.push(text[j]);
}
}
}

please help


Help with Your second "for" loop!
#2

That happened to me too and i cant figure it out


#3

Where is the end to your loop?

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

The second loops wont work because all you've declared in the first is that i = 0

There might be something else, but this is what I've noticed so far.


#4

I got some help and this was my final code
/*jshint multistr:true */
var text = "Hey, how are you \
doing? My name is Renee .";
var myName = "Renee";
var hits = [];

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


#5

This worked. Thank you!