What does strict mode change about hoisting behavior?
It makes related bugs visible. Assigning to an undeclared variable throws ReferenceError instead of creating a global. this is undefined in regular functions instead of the global object. Duplicate parameter names throw.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Hoisting in Strict Mode JavaScript
No. Hoisting still happens. var is hoisted with undefined, function declarations with their full body, and let/const sit in the TDZ. Strict mode does not change the hoisting mechanism itself.
Yes. Any file with import or export is automatically in strict mode. You do not need 'use strict'. Top-level this is undefined in modules, not the global object.
It throws ReferenceError: x is not defined. In sloppy mode, it would silently create a global variable on the window object, which is a common source of bugs.
Still have questions?
Browse all our FAQs or reach out to our support team
