Help finding error in my second "For" Loop


My error says:
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 = "This is a line of text.\
Eric Eric Eric";

var myName = "Eric";

var hits = [];

for (var i = 0; i < text.length; i++) {
    if (text[0] === 'E') {
        for (var j = i; j < i+myName.length; j++) {


Change to 0 to i...

if (text[i] === 'E')


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