Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

closure in javascript

function makeFunc() {
  var name = 'Mozilla';
  function displayName() {
    alert(name);
  }
  return displayName;
}

var myFunc = makeFunc();
myFunc();
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #closure #javascript
ADD COMMENT
Topic
Name
3+8 =