Have a problem with "Your second "for" loop"


#1



https://www.codecademy.com/courses/javascript-beginner-en-XEDZA/0/5?curriculum_id=506324b3a7dffd00020bf661#

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.

Hello, it seems to me that there is something wrong with this exercice. I have a mistake message that tells me that it cant push values into hits array. So here is my code, hope you will help.

var text = "some text"
var myName = "Jean"
var hits = []

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


#2

Hi you should put at least once your name in the variable text

var text = "some text"