5. Your second "for" loop


#1

It keeps on saying
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? My name is Emily.";
var myName = "Jayden";
var hits = []; 

for(var i = 0; i > text.length; i++) {
if(text[i]=="e") {

    for(var j = i; j < myName.length + i; j++)
    {
        hits.push("j");
    }

    }
}

#2

your name is Jayden, but in your if condition which checks for the first letter of you name you have:

if(text[i]=="e")

you have an e, why? Keep in mind string comparison is case sensitive.

also, your first for loop, take a good look at the loop condition, this condition is false, so the first for loop never runs


#3

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