Body of Second for Loop


I'm a bit lost with how to troubleshoot the below error message:

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 = "Though my name is Asif.";
var myName = "Asif";
var hits =[];

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


The instructions ask you to push the results to the array that's already been made, the hits array.


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