Every makeCounter() call builds a house in Gang Kenari: call the counters, build a second, let one go. Whose piggy bank of count goes up? Pak RT at the watch…
The key idea
Every makeCounter() call builds a new scope
Try it in this playground
Build a second house Call makeCounter() once more. The code is the same, but the house and its count are new.
Call one, the others stay put Call a() a few times, then b(). b() starts from 1: a's piggy bank does not change.
Peek at count from outside Code outside makeCounter cannot read count. The browser itself refuses: ReferenceError.
Let go of a counter a = null: nothing can call a any more, so its house cannot be reached. The JS engine may clean it up later, whenever it chooses; not at once.