What does "use strict" do in JavaScript, and what is the reasoning behind it?
What does "use strict" do in JavaScript, and what is the reasoning behind it?
33027-Oct-2022
Updated on 27-Oct-2022
Home / DeveloperSection / Forums / What does "use strict" do in JavaScript, and what is the reasoning behind it?
What does "use strict" do in JavaScript, and what is the reasoning behind it?
Gourav Jangra
28-Oct-2022Strict Mode makes easier to write secure Javascript.Strict mode changes previously accepted bad syntax into real errors.
As an example, in normal JavaScript, mistyping a variable name creates a new global variable. In strict mode, this will throw an error, making it impossible to accidentally create a global variable.