Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

closure examples

function makeFunc() {
  const name = 'Mozilla';
  function displayName() {
    console.log(name);
  }
  return displayName;
}

const myFunc = makeFunc();
myFunc();
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #closure #examples
ADD COMMENT
Topic
Name
6+4 =