Skip to content

Instantly share code, notes, and snippets.

@jasminegmp
Last active February 21, 2020 23:08
Show Gist options
  • Save jasminegmp/0713a7a96afebb8d9fd3dd0831f90419 to your computer and use it in GitHub Desktop.
Save jasminegmp/0713a7a96afebb8d9fd3dd0831f90419 to your computer and use it in GitHub Desktop.
function myFunction(){
let a; // a's declaration is hoisted here, but remains uninitialized
a; // Will get a ReferenceError: Cannot access 'a' before initialization
console.log(a);
a = 'hello'; // everything above this line of code is referenced as temporal dead zone
}
myFunction();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment