Search Text for your name: 5, Your second "for" loop


I keep getting this error, and I have the EXACT code that some of the resolutions has, but i continue to get the error. Help anyone?

Search Text for your name: 5, Your second "for" loop

"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."

/*jshint multistr:true */
var text = "QQASDASD Caleb LASKDLADSL Caleb KASDK Caleb ASD Caleb";
var myName = "Caleb";
var hits = [];

for(var i = 0; i < text.length; i++);
    if(text[i] === "C")
        for(var j = i; j < (i + myName.length); j++)


the semi-colon after i++) interrupts the loop, remove it.


This makes me cry every time it happens. Thanks!


you have to be careful with using semi-colons correctly in JS


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.