Body of Second for Loop


#1



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++) {
    if(text[i]==='A'){
        for (var j = i; j < i + myName.length; j++){
        newArray = [i];
        newArray.push(j);
        newArray[0];
        }
    }
}


#2

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


#3

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