Second for loop in "Search Text for your Name" - can't find the mistake


#1

I seem to get an error, but i'm sure that my code is correct. What's wrong, or what am I missing?


This is the error message that I get:
"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 = "Carrie blah yilenawfke Carrie";
var myName = "Carrie";
var hits = [];

for (i = 0; i > text.length; i++) {
    if (text[i] === "C") {
        for(j = i; j > (i + myName.length); j++) {
            hits.push(myName[j]);
        }
    }
};


#2

This will keep the loop from running. Change > to <.


#3

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