Stuck in part 3: SyntaxError: Invalid or unexpected token


#1

https://www.codecademy.com/en/courses/javascript-beginner-en-x9DnD/0/3?curriculum_id=506324b3a7dffd00020bf661

SyntaxError: Invalid or unexpected token

Oops, try again. There was a problem with your syntax.


'// Check if the user is ready to play!
confirm("Yes, I'd love to play!")

var age = prompt("What's your age");

if(age<13) 
{
   console.log("You're allowed to play but we take no responsibility")
}
else   // "otherwise"
{
    console.log("Welcome to play!")
}

console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'")

What should I do? Thanks!


#2

Maybe it is the comma,
First line.


#3

I would take out the comment after else

Good code structure can be a very important.

if(condition) {
stuff
} else {
otherStuff
}


#4

its part of the first line comment. there is a ' at the very beginning that makes it a string and not a comment
'// Check if the user is ready to play!


#5

Thanks! It was the comma! No idea how that got in there in the first place... :slight_smile:


#6

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