Facebook Pixel

Does strict mode disable hoisting in 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.

Verify This Answer

Cross-check this information using these trusted sources:

More FAQs in Hoisting in Strict Mode JavaScript

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.

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

Want to upskill yourself?

Our courses are taking a Coffee break, but your curiosity shouldn't. Stay engaged with namastedev linkedin, youtube, discord and other resources while you wait.

0
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.