Closures Flashcards

1
Q

Closures:

What is it called when a function retains a reference to variable in its outer scope?

A

A closure

function myobject(){
   var value;
   return {
      set: function(v) { 
         value = v
      };
      get: function { 
         return value
      };
   }
}

Get and set are closures.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly