QuestenaPractice that shows what to review next
Question 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 closureCorrect answer

Explanation

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.

Continue with this test

Start practice
Question 84: A factory call creates a local count binding and returns an… · JavaScript Fundamentals · Questena