Same problem as others--won't push to the array


I've spent an hour reading other threads with this exact problem, but have not figured out the problem with my code. I HAVE to be very close. It's probably something really stupid.

var text = "All work and no play makes Bruce a dull boy. \ And when Bruce is a dull boy, he is really no fun.";
var myName = "Bruce";
var hits= [];
for (var i = 0; i<text.length; i++);
if (text[i]==="B")
for (var j = i; j < i+myName.length; j++)


yep, it is something very stupid, this line:

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

the semi-colon after i++) interrupts the loop, remove the semi-colon


ugh. I can't believe I wasted so much time trying to find that!!


there are javascript debuggers available online, you could consider using them if you get stuck for a really long time.


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