Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1. var a = 10; // global scope
  2. function foo() { // enter new scope, TDZ starts
  3.  
  4. // Uninitialised binding for 'a' is created
  5. console.log(a); // ReferenceError
  6.  
  7. // TDZ ends, 'a' is intialised with value of 20 here only
  8. let a = 20;
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement