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 |
|---|
| JavaScript Introduction |
| JavaScript Environment Setup |
| JavaScript Basic Program |
| JavaScript Output |
| JavaScript Syntax |
| JavaScript Comments |
| JavaScript Console |
| Exercises & Assignments |
|---|
| Write a JavaScript program to display Hello World |
| Interview Questions & Answers |
|---|
| What is JavaScript? |
| What is strict mode in JavaScript? |