LearnFrenzy
Sign in Take a free test

JavaScript Basics · Find the Error · Question 8

Error: variable name with the wrong case Answer, explanation & discussion

  • Find the error
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 8 Back to Exercise

The code below stops with an uncaught error. Which statement correctly describes the problem?

main.js
let price = 250;
let quantity = 3;
console.log("Bill:", Price * quantity);
  • A It prints Bill: 750
  • B It prints Bill: NaN
  • C TypeError: Price is not a number
  • D ReferenceError: Price is not defined – the variable is price Correct
Correct Answer: Option D

Identifiers are case-sensitive. Reading a name that was never declared throws ReferenceError (unlike typeof, which would return "undefined").

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