Created
February 13, 2014 11:37
-
-
Save paprikka/8973639 to your computer and use it in GitHub Desktop.
This file contains 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 a = 'foo'; | |
function foo() { | |
console.log(a); | |
var a = 'bar'; | |
console.log(a); | |
}; | |
foo(); | |
// LOG: | |
// undefined | |
// bar | |
"use strict" | |
var a = 'foo'; | |
function foo() { | |
console.log(a); | |
let a = 'bar'; | |
console.log(a); | |
}; | |
foo(); | |
// LOG: | |
// console.log(a); | |
// ^ | |
// ReferenceError: a is not defined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment