5/7: Derp


#1

The error message says to make sure I'm pushing letters to the array. I believe this translates to "WHAT ARE YOU EVEN DOING." The problem is,

so I really need help.

Here's my code.

/*jshint multistr:true */
var text = "MEOW MEOW MEOW Peter MEOW MEOW Peter \
MEEEEP MEEP MEEP Peter MEEP MEEP MEEP MEEP MEEP MEEP \
MeOw MeEp MEOW Peter.";
var myName = "Peter";
var hits = [ ];
for (var i = 0 ; i <= text.length ; i++) {
    if (text[i] === myName[0]) {
        for (var j = i; j < myName.length + i; j++) {
            hits.push(text[myName])
            hits[0]
        }
    }
}

#2

You do not need:

hits[0]

Also, for this:

hits.push(text[myName]

You're supposed to do this:

hits.push(text[j])

Also put a semi colon after that.

I believe that those corrections will fix the problem. Hope it helped! :smiley:


#3

@pigglefurp,
and change

into
for (var i = 0 ; i < text.length ; i++) {


#4

Thanks, guys! This saved me a crap-ton of sanity.


#5

I wish I could upvote you for "Most entertaining" :laughing:

Thank you for asking this question as I was having the similar issues.

~Gena