Can't figure this out! Help!


I can’t figure this out! What’s wrong with my code? I’ve been looking at it for days now.

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.

var text = "Hi my name is Jenny, this lesson is driving me insane"
var myName = "Jenny"
var hits = [ ] 
for ( var i = 0; i >= text.length; i++){
    if ( text[i] === "J" ) {
        for ( var j = i; j < (myName.length+i); j++) {


Reverse the direction of this comparison and remove the =. It should always be less than text.length.


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