Second For Loop


#1
/*jshint multistr:true */
var text= "Garrett is a potato. And potato is a Garrett"
var myName = "Garrett"
var hits= []
for(var i = 0; i< text.length; i++){
    if(text[i]==='G'){
            for( var j = i; j > i + myName.length; j+i){
    newArray = [];
    newArray.push('Garrett');
    newArray[0]; //equals 'Garrett'
    }
}
}

new array is grey and .push is light blue, when I submit it it says this:

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.


#2

Have you tested your own code?
Keep in mind that you can print out what it is doing step by step by adding console.log's

Or even just read what it does, pretend you're the interpreter.

Are you clear on what the instructions ask you to do? What do you expect should happen?
What should hits be after the code is done? Does your code produce that result when you run your code in your head?