Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var z = 5;
- function outer() {
- var x = 0;
- console.log(y, x, z);
- // logs “undefined, 0, 5”. I am not within the same closure as y, but I am with x, z
- function inner() {
- var y = 1;
- console.log(x, y, z), // logs “0, 1, 5”. I am in the closure with x, y, and z.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement