Skip to content

Instantly share code, notes, and snippets.

@Hlight
Last active January 29, 2019 22:35
Show Gist options
  • Select an option

  • Save Hlight/b77ddb25c39e738e08b8590c6e7a3b1a to your computer and use it in GitHub Desktop.

Select an option

Save Hlight/b77ddb25c39e738e08b8590c6e7a3b1a to your computer and use it in GitHub Desktop.

Revisions

  1. Hlight revised this gist Jan 29, 2019. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions js-strict-mode.md
    Original file line number Diff line number Diff line change
    @@ -9,16 +9,16 @@ The following is a summary extracted from changes documented in the [strict mode

    * Variables can’t be left undeclared
    * Function parameters must have unique names (or are considered syntax errors)
    * with is forbidden
    * `with` is forbidden
    * Errors are thrown on assignment to read-only properties
    * Octal numbers like 00840 are syntax errors
    * Octal numbers like `00840` are syntax errors
    * Attempts to delete undeletable properties throw an error
    * delete prop is a syntax error, instead of assuming delete global[prop]
    * eval doesn’t introduce new variables into its surrounding scope
    * eval and arguments can’t be bound or assigned to
    * arguments doesn’t magically track changes to method parameters
    * arguments.callee throws a TypeError, no longer supported
    * arguments.caller throws a TypeError, no longer supported
    Context passed as this in method invocations is not “boxed” (forced) into * becoming an Object
    * No longer able to use fn.caller and fn.arguments to access the JavaScript stack
    * `delete prop` is a syntax error, instead of assuming `delete global[prop]`
    * `eval` doesn’t introduce new variables into its surrounding scope
    * `eval` and arguments can’t be bound or assigned to
    * `arguments` doesn’t magically track changes to method parameters
    * `arguments.callee` throws a TypeError, no longer supported
    * `arguments.caller` throws a TypeError, no longer supported
    * Context passed as `this` in method invocations is not “boxed” (forced) into becoming an Object
    * No longer able to use `fn.caller` and `fn.arguments` to access the JavaScript stack
    * Reserved words (e.g protected, static, interface, etc) cannot be bound
  2. Hlight created this gist Jan 29, 2019.
    24 changes: 24 additions & 0 deletions js-strict-mode.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    # Strict Mode
    _https://ponyfoo.com/articles/es6-modules-in-depth_

    In case it isn’t immediately obvious – you should 'use strict' in all the places. Even though it’s becoming de-facto in ES6, it’s still a good practice to use 'use strict' everywhere in ES6.

    In the ES6 module system, strict mode is turned on by default. In case you don’t know what strict mode is, it’s just a stricter version of the language that disallows lots of bad parts of the language. It enables compilers to perform better by disallowing non-sensical behavior in user code, too.

    The following is a summary extracted from changes documented in the [strict mode article](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode) on MDN.

    * Variables can’t be left undeclared
    * Function parameters must have unique names (or are considered syntax errors)
    * with is forbidden
    * Errors are thrown on assignment to read-only properties
    * Octal numbers like 00840 are syntax errors
    * Attempts to delete undeletable properties throw an error
    * delete prop is a syntax error, instead of assuming delete global[prop]
    * eval doesn’t introduce new variables into its surrounding scope
    * eval and arguments can’t be bound or assigned to
    * arguments doesn’t magically track changes to method parameters
    * arguments.callee throws a TypeError, no longer supported
    * arguments.caller throws a TypeError, no longer supported
    Context passed as this in method invocations is not “boxed” (forced) into * becoming an Object
    * No longer able to use fn.caller and fn.arguments to access the JavaScript stack
    * Reserved words (e.g protected, static, interface, etc) cannot be bound