I can't find my mistake


#1

var text = "Jack be nimble, Jack be quick, Jack jumped over the candle stick!"
var myName = "Jack";
var hits = [];
for (var i = 0; i < text.length + 1; i++)
{if (text[i] === "J")
{for (var j = i; j < (myName.length + i); j++)}
{hits.push(text[j]);}}

I can't find my mistake. Can anyone see it? I get this error: SyntaxError: Unexpected token }


#2

On line 6 you closed the loop you just created:

You should instead move that Curly Bracket down to after the last line.


#3

That was it. Problem solved. THANK YOU!


#4

Welcome, and good luck further! Post on the forum if you have any trouble and I'll help if I see it!