Can't figure out where the error is - please help


#1

Keep getting the error - "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."

var text = "Isn't Josh the best looking guy in the world? Josh always has a smile and everyone wants to be friends with Josh.";
var myName = "Josh";
var hits = [];
for (i = 0; i < text.length; i++); {
if (text[i] === "J") {
for (var j = i; j < myName.length + i; j++) {
hits.push(text[j]);
}
}
};


#2

in this line:

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

you have a semi-colon after the closing bracket ()), which shouldn't be there. Because of this, the first loop never gets executed


#3

My hero!
Thank's for your help.