Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. var z = 5;
  2. function outer() {
  3. var x = 0;
  4. console.log(y, x, z);
  5. // logs “undefined, 0, 5”. I am not within the same closure as y, but I am with x, z
  6.  
  7. function inner() {
  8. var y = 1;
  9. console.log(x, y, z), // logs “0, 1, 5”. I am in the closure with x, y, and z.
  10. }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement