Your second "for" Loop


#1



I get the error message "Oops, try again. Make sure you're pushing letters to the hits array!"
And my outcome is 15


var text = "I ate a potatoe with tomatoes\
because the potatoe said my name Henry because Henry\
and awesome name for Henry."
var myName = "Henry";
var hits = [];

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


#2

this should be hits.push( text[j])


#3

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