Search Knowledge

© 2026 LIBREUNI PROJECT

Strict Mode and Modern ECMAScript Evolution

The Evolution of the ECMAScript Standard

JavaScript, or more formally ECMAScript (ES), has transformed from a simple scripting language for browser-side validation into a versatile, high-performance general-purpose language. This evolution is marked by the pivot from the chaotic “sloppy mode” of early implementations to the disciplined and optimized environment provided by “strict mode” and the ES6 (ES2015) revolution.

Strict Mode: Enforcing Discipline

Introduced in ECMAScript 5, "use strict"; is a literal expression that instructs the JavaScript engine to execute the code in a more rigorous manner. Strict mode is not just a style choice; it intentionally changes the semantics of the language to prevent common errors and enable certain optimizations.

Key Restrictions in Strict Mode

  1. Elimination of Silent Failures: In sloppy mode, assigning a value to a non-existent variable implicitly creates a global variable. In strict mode, this throws a ReferenceError.
  2. This Binding: In a standard function call, this defaults to the global object (window or global). In strict mode, this remains undefined, preventing accidental pollution of the global namespace.
  3. Prohibiting Duplicates: Strict mode forbids duplicate property names in object literals and duplicate parameter names in functions.
  4. Security Measures: It prevents access to fn.caller and fn.arguments for security reasons, making it harder to “spy” on the call stack.
javascript
1"use strict";
2 
3try {
4 x = 3.14; // Throws ReferenceError because x is not declared
5} catch (e) {
6 console.log(e.name + ": " + e.message);
7}

Modern Variables: Scoping

ES6 introduced let and const to address the flaws of var. While var is functionally scoped and subject to “hoisting”, let and const are block-scoped.

The Temporal Dead Zone (TDZ)

let and const variables exist in a “Temporal Dead Zone” from the start of the block until declaration. Accessing them before declaration results in a ReferenceError.

Featurevarletconst
ScopeFunctionBlockBlock
Re-assignmentYesYesNo
HoistingYesTDZTDZ

Arrow Functions and Lexical Context

Arrow functions (() => {}) provide a more concise syntax, but their primary utility lies in their handling of the this keyword. Unlike standard functions, arrow functions do not have their own this context. Instead, they capture the this value of the enclosing lexical scope at the time they are defined.

This makes arrow functions ideal for callbacks and methods where you want to maintain access to the parent object’s context without using .bind(this) or aliases like var self = this;.

Which of the following is TRUE regarding strict mode in JavaScript?