Explain the concept of "use strict" in JavaScript

Beginner

Answer

"use strict" enables strict mode, which catches common coding mistakes and prevents certain actions. It makes JavaScript more secure and optimized by:

  • Preventing use of undeclared variables
  • Disallowing duplicate parameter names
  • Making this undefined in functions (not global object)
  • Preventing deletion of variables, functions, or arguments