HALP PLS Search Text For Your Name 5/7


#1



Can someone please help? I've been trying to figure this part out and I keep getting this message no matter how I change it:
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 = "blahhPotatoblahhhhhhhhhhhhhhhhhhhPotato";
var myName = "Potato";
var hits = [];
for (var a = 0; a <= text.length; a++); {
    if (text[a] === "P") {
        for (var b = a; b <= (a + myName.length); b++); {
            hits.push(text[b]);
        }
    }
};


#2

In both loops, this should be < so it does not seek out of range.


#3

I tried that, but it's giving me the exact same error.
Thank you.


#4

There is a semi-colon in both loop statements that should not be there.

);{

#5

That was it!
Thank you very much. :>


#6

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