Ask coding questions

← Back to all posts
SyntaxError: Unexpected token (38:2)
gozalsabirova (3)

I keep getting an error message when I try to run this. I've toyed around with the code, but can't seem to figure out the problem. Any ideas what's wrong?

Answered by PYer (4010) [earned 5 cycles]
View Answer
PYer (4010)

Hello @gozalsabirova! Next time you ask a question, it would be more helpful to link the repl rather than share screenshots, but to answer your question:
The problem is that you have no value in between the braces. Therefore, the waits for a variable to be passed, and then unexpectedly stumbles across the ending brace (}). Therefore, it raises an error pointing it out. To fix it, you should include the variables you want to print inbetween the braces, as shown below:

console.log(`This is what I'm wearing today:
${torsoClothing} on my torso
${legClothing} on my legs
${footWear} on my sneakers

Please mark this as the answer if it helps! Thank you!

AphixDev (213)

@PYer A pro has arrived xD

PYer (4010)

I'm better at python than js... @nt998302

AphixDev (213)

@PYer Then I'm like you except I don't know js :P

PYer (4010)

Lol. I have a very limited knowledge, I guessed at the error first, but then had to go research it more just to check. @nt998302

AphixDev (213)

@PYer I tried javascript one summer and to this day I still don't like it and don't have a clue as to how to do it xD

gozalsabirova (3)

thank you!!! it worked. much appreciated :) @PYer


You need a semicolon at the end of each line (not the if or else if statements).

AphixDev (213)

Okay. I believe you need a semicolon after many lines.

AphixDev (213)

@gozalsabirova Just look at @PYer 's answer. He's good.