Skip to content

Instantly share code, notes, and snippets.

@paprikka paprikka/let.js
Created Feb 13, 2014

Embed
What would you like to do?
"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
You can’t perform that action at this time.