Second for loop


#1



second for loop


The error
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 = "hey how are you doing Nathan is doing good"
var myName = "Nathan";
var hits =[];

for (var i = 0 ; text.length < "text" ; i++){
    if (text[i] === "N"){
        for(var j = i; j < i+myName.length ; j++){
            hits.push(text[j]);
            }
        
        }
    }


#2

add console.log to print
like

console.log(hits)

but your for loop is not right

@gorcler


#3

why this condition in your first for loop:

text.length < "text"

i would do:

i < text.length;

this will make i loop over the text in your text variable