made with esnextbin
Last active
September 21, 2016 09:11
-
-
Save DamianMullins/1459bb9a259abd5f7bf61ae280baa9dd 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
var foo = true; | |
// Fake block scope; bar belongs to the enclosing scope | |
if (foo) { | |
var bar = foo * 2; | |
console.log('bar inside if', bar); | |
} | |
console.log('bar outside if', bar); | |
// Block-scoping with let | |
{ | |
console.log('bat before declaration', bat); // ReferenceError! | |
let bat = 2; | |
console.log('bat after declaration', bat); // ReferenceError! | |
} | |
if (foo) { | |
let baz = foo * 2; | |
console.log('baz inside if', baz); | |
} | |
console.log('baz outside if', baz); |
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'; | |
var foo = true; | |
// Fake block scope; bar belongs to the enclosing scope | |
if (foo) { | |
var bar = foo * 2; | |
console.log('bar inside if', bar); | |
} | |
console.log('bar outside if', bar); | |
// Block-scoping with let | |
{ | |
console.log('bat before declaration', bat); // ReferenceError! | |
var bat = 2; | |
console.log('bat after declaration', bat); // ReferenceError! | |
} | |
if (foo) { | |
var _baz = foo * 2; | |
console.log('baz inside if', _baz); | |
} | |
console.log('baz outside if', baz); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment