Hits Array!


#1

It's telling me that my second loop is not pushing to the hits array...can anyone help?! I've been staring at it for an hour and a half lol.

var text = "Hey, how are you doing? my name is Mike.";
var myName = "Mike";
var hits = []
for(var i = 0; i if (text[i] ==="M") {
for(var j = i; j + (myName.length +i); j++) {
hits.push(text[j]);
}
}
}


#2

for(var j = i; j + (myName.length +i); j++) {
                 ^

change the condition to reflect a condition statement.

so instead of j + (myName.length + i) ; try j < (myName.length + i) ;

for(var j = i; j < (myName.length +i); j++) {
                 ^