made with esnextbin
Last active
September 21, 2016 08:00
-
-
Save DamianMullins/3c51c35c4417f5a3b81dae99b9c54f2e to your computer and use it in GitHub Desktop.
esnextbin sketch
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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ESNextbin Sketch</title> | |
<!-- put additional styles and scripts here --> | |
</head> | |
<body> | |
<!-- put markup and other contents here --> | |
</body> | |
</html> |
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
function foo (a) { | |
function bar () { | |
var a = 99; | |
} | |
function baz () { | |
a = 99; | |
} | |
bar(); // Calling this returns 1 as a was declared as a shadowed variable using `var` | |
baz() // Calling this returns 99 as a refers to the a variable in the scope of `foo()`, which is then redefined | |
console.log(a); | |
} | |
foo(1); |
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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0" | |
} |
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
"use strict"; | |
function foo(a) { | |
function bar() { | |
var a = 99; | |
} | |
function baz() { | |
a = 99; | |
} | |
bar(); // Calling this returns 1 as a was declared as a shadowed variable using `var` | |
baz(); // Calling this returns 99 as a refers to the a variable in the scope of `foo()`, which is then redefined | |
console.log(a); | |
} | |
foo(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment