Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

what is closure

outer = function() {
  var a = 1;
  var inner = function() {
    console.log(a);
  }
  return inner; // this returns a function
}

var fnc = outer(); // execute outer to get inner 
fnc();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #closure
ADD COMMENT
Topic
Name
2+3 =