Jake
Jake

Reputation: 3486

Uncaught SyntaxError: Unexpected token ILLEGAL on javascript objects

I am trying to create an object in javascript that has an object inside of it and I am getting the following error:

Uncaught SyntaxError: Unexpected token ILLEGAL

This is my code

var motivateEN = {
    0 : {0: "{name}, keep studying this lesson for a better score.", 1: "Bad luck {name}, keep studying this lesson to improve.
"},
    50:{0: "Practice makes perfect {name}, try this lesson again.",1:"Not bad, but better luck next time {name}!",2:"Well done {name}, you’re on the right track!"},
    85:{0:"Congratulations {name}, lesson complete!",1:"Woohoo, lesson complete {name}!",2:"Awesome stuff {name}! Keep it up!",3:"Great skills! Well done {name}!
"},
    100:{0: "Perfect {name}! Keep up the good work!",1:"Congratulations {name}, you got a perfect score!"} 
};

Upvotes: 0

Views: 473

Answers (1)

Daniel Kaplan
Daniel Kaplan

Reputation: 67320

If you take this code and format it, the error is more obvious:

var motivateEN = {
    0: {
        0: "{name}, keep studying this lesson for a better score.",
        1: "Bad luck {name}, keep studying this lesson to improve.
        "},
...

You can't use a newline in the middle of a string

Upvotes: 2

Related Questions