LearnFrenzy
Sign in Take a free test

Data Types · Find the Error · Question 2

Error: misplaced numeric separator Answer, explanation & discussion

  • Find the error
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 2 Back to Exercise

JavaScript refuses to run the code below. Which statement correctly describes the problem?

main.js
const salary = 12_00_000_;
console.log(salary);
  • A It prints 1200000
  • B It prints 12_00_000
  • C SyntaxError: a numeric separator (_) cannot end a number Correct
  • D ReferenceError: _ is not defined
Correct Answer: Option C

Underscores may appear only between digits (12_00_000 is fine and equals 1200000). A trailing, leading or doubled separator is a SyntaxError.

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