What Is A Closure?
One of the key truths of JavaScript is that everything is an object. This, of course, includes functions.
A closure is nothing more than a function object with a related scope in which the function’s variables are resolved.
Closures get their name because of the way they close over their contents.
"A quick recap of what we learned:A closure is nothing more than a function object with a scope.
Closures get their name by the way they “close” over their contents.
Closures cash in big time on JavaScript’s lexical scope.
Closures are the way to achieve privacy in JavaScript.
Closures are able to capture the local variable and parameter bindings of an outer function.
JavaScript can be powerfully extended with some closure magic.
Closures can be used with many of your favorite libraries to make them even cooler!
Thanks so much for reading! Feel free to ask any questions. Now let’s enjoy the pizza party!"
0 comments:
Post a Comment