I'm working on the second "for" loop inside the if statement in Javascript. I'm confused with what I need to put in the loop in terms of the variables. The directions are confusing!


#1

/*jshint multistr:true */
var text = "Hey, how are you?  My name is Mark. It's Mark";
var myName = "Mark";
var hits = [];

for (var i = 0; i < text.length; i++) {
    if (text[i] === 'M') {
    console.log("I would like to visit " + myName[0]);
    newArray = [];
    newArray.push('hello');
    newArray[0];
    for (var j = i; j < i + myName.length; j++) {
        console.log("I would like to visit " + newArray[0]);
}
}
}

#2
for (var i = 0; i < text.length; i++) {
    if (text[i] === 'M') {
       //console.log("I would like to visit " + myName[0]);
       //newArray = [];
       //newArray.push('hello');
       //newArray[0];
       for (var j = i; j < i + myName.length; j++) {
       // console.log("I would like to visit " + newArray[0]);
            hits.push(text[j]);
       }
    }
}
console.log( hits );