Skip to content

Instantly share code, notes, and snippets.

@thebopshoobop
Created July 31, 2017 02:56
Show Gist options
  • Save thebopshoobop/50f3fac8e3e6720e5619c36b54fd06a1 to your computer and use it in GitHub Desktop.
Save thebopshoobop/50f3fac8e3e6720e5619c36b54fd06a1 to your computer and use it in GitHub Desktop.
var baz = 'yes';
if (true) {
var baz = 'no';
}
console.log(baz); // 'no'
let bar = 'yes';
if (true) {
let baz = 'no';
}
console.log(baz); // 'yes'
let foo = 'yes';
let foo = 'no'; // SyntaxError: 'foo' has already been declared
for (var i = 0; i < 4; i++) {
baz[i] = True;
}
console.log(i); // 4
for (let j = 0; j < 4; j++) {
baz[j] = False;
}
console.log(j); // ReferenceError: j is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment