"Make sure you're pushing letters to the hits array" error message


#1

I need someone to review my code and see what I'm doing wrong in order to get the number of letters in my name instead of the letters themselves:

var text = "My parents named me Heather because they thought it was a nice-sounding name, but I've known so many females named Heather that I've come to think of it as almost a generic name.";
var myName = "Heather";
var hits = [];
for (var i = 0; i < text.length; i ++); {
    if (text[i] === 'H'); {
        for (var j = i; j < (i + myName.length); j ++)
        {hits.push(text[j])
        }
    }
}

Every time I try to run it, I get the same error message: "Make sure you're pushing letters to the hits array." What exactly does this mean? I've looked at it for so long that it's starting to look like jibberish. Please help!


#2

You are using too many ";".


#3

I knew it had to be something tiny that I just couldn't see. Thanks!


#4

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