Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

What Is A Closure: Informal Explanation

-Closures are a bit like classes.
-They have a function inside of them. 
-Closures return a function. 
-You can create an "instance" of a closure with new Closure(). 
-Everytime you execute the "instance" you are executing the returned function.
-Counter is the most famous example: everytime you execute a counter() instance, you execute the "increaseCounter" function being returned
 
PREVIOUS NEXT
Tagged: #What #Is #A #Informal #Explanation
ADD COMMENT
Topic
Name
4+5 =