Ask coding questions

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

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 [earned 5 cycles]
View Answer
Voters
gozalsabirova
Comments
hotnewtop
PYer

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:

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

AphixDev

@PYer A pro has arrived xD

PYer

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

AphixDev

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

PYer

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

@PYer I see.

AphixDev

@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

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

[deleted]

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

AphixDev

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

AphixDev

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

AphixDev

What lang?

gozalsabirova

Javascript @nt998302