Question 9
Back to Exercise
In strict mode, what happens when you assign to a variable that was never declared, e.g. total = 50;?
- A A global variable named total is created
- B The assignment is ignored silently
- C A ReferenceError is thrown Correct
- D total becomes a constant
Correct Answer: Option C
Non-strict code silently creates a global property; strict mode throws ReferenceError: total is not defined, catching typos early.
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!