Aprende todo un fin de semana sin pagar una suscripción 🔥

Regístrate

Comienza en:

03D

22H

29M

18S

1

avanzado para developers

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

Escribe tu comentario
+ 2