#5 your second for loop, HELP!



error:Oops, try again. There was a problem with your syntax.
I have been stuck on this for a day and have no idea what i'm really supposed to be doing. Any help is greatly appreciated!

var myName = "Oscar";
var hits["Oscar"];
for(var i=0; i< text.length; i++){
if(text[i] ==="O")
{for( var j = i;j<i+myName.length; j++ )


HI this line

var hits["Oscar"];

I think you should put hits equal to a empty array

var hits = [];

then you don't need of the else {} remove it .. then you should open the seconde for loop {


i did the same thing...
getting the error: "Careful: your second 'for' loop should stop when it reaches its current point in the string + myName.length."
my code is:
var hits = [];
for(i = 0 ; i if(text[i] === 'p'){
for( var j=i; j<(i+text.length); j++ )


Hi this part

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

instead of text.length you should put myName.length


thank u:slight_smile: