PROGRAMMING

  MINTE9
REMEMBERS




Last update:   17-01-2022

Strict

To keep the old code working, modern modifications are off by default.
 
/**
 * When 'use script' it is located at the top of a script, 
 * the whole script works the “modern” way 
 * starting with ECMAScript 5
 * 
 * To keep the old code working, 
 * modern modifications are off by default.
 */
"use strict";

let a = 1;
    // Correct

b = 1;
    // ReferenceError: b is not defined

Classes

Modern JavaScript supports classes and modules (use strict enabled by default).
 
/**
 * In classes and modules, 'use strict' ...
 * is enabled by default
 */
class MyClass {
    constructor() {
        a = 1;
    }
}

let obj = new MyClass();
    // ReferenceError: a is not defined
    // Even if 'use strict' was not declared

Questions     github Fundamentals
Variables
        A B C D E F
🔔
1/2