SyntaxError: Unexpected Token }


First off, I'd just like to say that I don't even completely understand what's going on in this exercise. All of the other exercises were quite clear to me and I understood what was going on but I have no clue what I'm even really supposed to do in this exercise. If anyone could clear up what we're trying to do in the exercise that would be quite helpful.

Anyway, I'm pretty sure I don't have a spare } just lying around creating problems so I don't know how I'm getting this problem.


SyntaxError: Unexpected Token }

/*jshint multistr:true */
var text = "Hey, how are you \
doing? My name is Jonathan! \
Jonathan like the ocean as the ocean is a great place for Jonathan" 

var myName = "Jonathan"

var hits = []

for ( var i = 0; i < text.length; i++) {
    if (text[i] === "J") {
        for(var j = i; j === myName[0]; j++)



When a check of the brackets comes up correct, then there must be an error that is preceding the unexpected token.

Check the inner for loop. It should be, j < i + myName.length. Plus you have no code body on the inner loop (the actual error)

for () {



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