LearnFrenzy
Sign in Take a free test

JavaScript Basics · JavaScript Basics MCQ · Question 5

Which name is a valid identifier? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 5 Back to Exercise

Which of these is a valid JavaScript variable name?

  • A 2ndPrice
  • B $price_2 Correct
  • C final-price
  • D new
Correct Answer: Option B

Identifiers may contain letters, digits, _ and $ but cannot start with a digit. The hyphen is the minus operator, and new is a reserved word.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links