What is strict mode in JavaScript?

Strict mode makes JavaScript stricter, so common mistakes throw errors instead of failing silently. Turn it on with "use strict" at the top of a file or function.

"use strict";

x = 10;   // ReferenceError: x is not defined (no var, let or const)

Modules and classes always run in strict mode.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.