closure_js
a closure is a function that references variables in the outer scope from its inner scope. The closure preserves the outer scope inside its inner scope.
function A(a){
function B(b){
console.log (a+b);
}
return B;
}
C=A(10);
C(40);
//console.log(C(20));
Comments
Post a Comment