DEV Community

wangxiaobo
wangxiaobo

Posted on

JavaScript "Closure"

Many powerful JavaScript libraries such as jQuery and Vue.js use the feature of closures to achieve

https://xiaobo.blog/javascript-closure

Top comments (1)

Collapse
 
linehammer profile image
linehammer

In many programming languages, the variables in scope are limited to global variables, parameters, and local variables. In languages which support closures , such as JavaScript, variables may also be bound dependent on the context in which a function was declared. A closure is a function that is evaluated in its own environment, which has one or more bound variables that can be accessed when the function is called. They come from the functional programming world, where there are a number of concepts in play. Closures are like lambda functions, but smarter in the sense that they have the ability to interact with variables from the outside environment of where the closure is defined.

net-informations.com/js/progs/clos...