2nd "for" loop help


#1

var text = "Hello my name is marc,marc likes football.";
var myName = "marc";
var hits =[]
for(var i = 0; i < text.length;i++)
if (text[i]==="m"){for (var j = i; j <= i + myName.length; j++)
{
hits.push(text[j]);


#2

Where am i going wrong?


#3

HI you should close your for loop


#4

@marc051

You have problem with your curly brackets:

Your loop part should look like this:

for(something) {
if(something) {
for(something) {
//here we do something
}
}
}