CARD 1
Introduction
Login to report note issues for this section.
Closures
A closure is a function that remembers and has access to variables from its outer (enclosing) scope even after that outer function has finished executing.
In other words — a closure is a function bundled together with its surrounding state (the lexical environment where it was defined).
codejs
outer() has returned and is finished. Normally, count would be destroyed. But inner holds a reference to count through a closure — so count persists in memory as long as inner is alive.