What is wrong?


#1


PLZZZ HALP stuck at for the past 3 hrs. Finally sucked up my pride :frowning:

The error msg: 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="Blah Blah Marcus";
var myName="Marcus";
var hits=[];
for(var i=0; i<text.length; i++ );
{
    if (text[i]==="M")
    {
        for(j=i; j < (myName.length + i); j++)
        {
        hits.push(myName[j]);
        }
    };
}


#2

Hi this line remove the ; at the end

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

You can read more about it here

then here

hits.push(myName[j]);

you should push inside hits text[j] and not myName[j]


#3

i know maybe the answer is obvious or what, but i dont get it, what does it mean to push into text[j]?


#4

and btw thx :smiley:


#5

you can fnd an accurate axplaination here


#6

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