QuestenaPráctica que te muestra qué repasar después
Pregunta 84

A factory call creates a local count binding and returns an inner function that reads count. The factory call has finished. Why can the inner function still read count?

  1. All local bindings automatically become global
  2. The factory call remains permanently active on the call stack
  3. The caller recreates count before every inner call
  4. The inner function retains its creation scope through a closureRespuesta correcta

Explicación

The returned inner function closes over the lexical environment in which it was created, retaining access to count after the factory call ends. The caller's current local variables do not replace that environment, because this access is lexical rather than caller-based.

Continúa con este test

Empezar la práctica
Pregunta 84: A factory call creates a local count binding and returns an… · JavaScript Fundamentals · Questena