Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Created September 29, 2012 18:19
Show Gist options
  • Save rwaldron/3804786 to your computer and use it in GitHub Desktop.
Save rwaldron/3804786 to your computer and use it in GitHub Desktop.
// Example
{
let f = function() {
console.log( foo );
};
f();
let foo = "foo!";
}
// Hoisted, with temporal dead zone highlight by HTML comments
{
let f, foo;
<!--
f = function() {
console.log( foo ); // will throw
};
f();
foo = "foo!";
-->
}
@mathiasbynens
Copy link

See https://gist.github.com/rwaldron/f0807a758aa03bcdd58a for an even better explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment