Define closure ?

Define closure.

In JavaScript, we need closures when a variable which is defined outside the scope in reference is accessed from some inner scope.

  1. var num = 10;  
  2. function sum()   
  3. {  
  4. document.writeln(num+num);  
  5. }   
  6. sum();  

Comments

Popular posts from this blog

CSS Layout - The position Property