Skip to content

Commit 67c319a

Browse files
committed
closures can also access the parent, parent variable
1 parent 5147770 commit 67c319a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

All Lessons/closure.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
function x(){
2-
var a = 10;
3-
return function y(){
4-
console.log(a);
1+
function z(){
2+
var b = 900;
3+
function x(){
4+
var a=10;
5+
function y(){
6+
console.log(a, b);
7+
}
8+
y();
59
}
10+
x();
611
}
7-
// after multiple line of code
8-
9-
var z = x();
1012
z();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy