Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var a = 10; // global scope
- function foo() { // enter new scope, TDZ starts
- // Uninitialised binding for 'a' is created
- console.log(a); // ReferenceError
- // TDZ ends, 'a' is intialised with value of 20 here only
- let a = 20;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement