Curso para Developers en Inglés (2020)

Toma las primeras clases gratis

COMPARTE ESTE ARTÍCULO Y MUESTRA LO QUE APRENDISTE

A closure is the combination of a function and the lexical scope in which the function was declared. In other words, closures or closures are functions that handle independent variables. In other words, the function defined in the closure “remembers” the scope in which it was created. mdn

keys

Simply: the function defined in the closure “remembers” the scope in which it was created
In short, it allows us to encapsulate code but with access to its context.
All that context you remember attacks RAM memory
We should not abuse this hack for performance issues
It is very useful to emulate private methods among other things
classic example

Curso para Developers en Inglés (2020)

Toma las primeras clases gratis

COMPARTE ESTE ARTÍCULO Y MUESTRA LO QUE APRENDISTE

0 Comentarios

para escribir tu comentario

Artículos relacionados