5/7 Confused. Why wont this work?


#1

/*jshint multistr:true */

var text = "When Michael jumped the fence he fell and then he ran across the bridge. Michael didn't think he would ever make it but he was eventually in Mexico.";

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

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

}
console.log(hits);

Why is this giving me an 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.

myName is in the text variable. So why isn't it pushing?


#2

I realized I had the > in the wrong direction.