1.

What is Closure with example?

Answer»

A function that can access its parent SCOPE, even after the parent function has CLOSED is CALLED JAVASCRIPT closure.

Example


function makeFunc() {
  var  type = 'circle';
  function displaytype() {
    alert(type);
  }
  return displayType;
}

var myFunc = makeFunc();
myFunc();



Discussion

No Comment Found