What is the ‘Strict’ mode in JavaScript and how can it be enabled?

What compulsions does ‘Strict’ mode add to javascript? How to enable ‘Strict’ mode in javascript.

  • Soni
  • 30 Apr 2026
  • 1049 Views
  • 2 Answers
Your Answer

Strict mode in JavaScript is a way to run code with stricter rules, which helps catch errors and prevents unsafe actions.

Enable it by adding:
JavaScript
"use strict";
You can place it:
At the top of a file (for whole script)
Inside a function (for that function only)

Javascript

Didn't get the answer.
Contact people of Talent-Javascript directly by clicking here