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

+9-7
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)