Your second 'for' loop


#1

I'm stuck at Search Text for your name, exercise 5. Your second "for" loop

It is stating that "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 = "blah blah blah blah blah blah blah \ blah blah Philip blah blah blah blah  \ blah blah blah blah Philip blah blah blah blah blah";

var myName = "Philip";
var hits = [];

for (var a = 0; a < text.length; a++); {
    if (text[a] == "P") {
        for(var b = a; b < (myName.length + a); b++) {
            hits.push(text[b]);    
        }
    }
}

#2

Anywhere you have an escape character (continuation operator \) there needs to be hard return immediately following. No other characters are allowed.


#3

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