Created
August 30, 2016 12:46
-
-
Save sairion/413e51f9266e4ffa96fec04f7d68d0a8 to your computer and use it in GitHub Desktop.
non-hoisting-behavior-of-let.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES5 lte | |
try { | |
var a = { | |
c:1, b: (function b() { return this.c }).bind(a) | |
}; | |
} catch(e) { console.warn(e); } | |
// ES2015 | |
try { | |
let a = { | |
c:1, b: (function b() { return this.c }).bind(a) | |
}; | |
} catch(e) { console.warn(e); /* ReferenceError: a is not defined */} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment