Skip to content

Instantly share code, notes, and snippets.

@mgol
Last active April 25, 2017 10:28

Revisions

  1. mgol revised this gist Apr 28, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion const-before-declaration.js
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,4 @@
    o.f();
    })();

    // Prints 'aaa'. Should it?
    // Prints 'aaa'.
  2. @mzgol mzgol created this gist Jan 7, 2014.
    12 changes: 12 additions & 0 deletions const-before-declaration.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    (function () {
    'use strict';
    const o = {
    f: function () {
    console.log(a);
    }
    };
    const a = 'aaa';
    o.f();
    })();

    // Prints 'aaa'. Should it?