Question d’entretien chez CREATEQ

What is a "closure" in JavaScript?

Réponse à la question d'entretien

Utilisateur anonyme

13 mai 2017

A closure is an inner function that has access to the variables in the outer (enclosing) function’s scope chain. The closure has access to variables in three scopes; specifically: (1) variable in its own scope, (2) variables in the enclosing function’s scope, and (3) global variables.