A private variable is a value kept inside an abstraction rather than exposed directly. In JavaScript, a closure lets returned functions continue accessing variables from the defining function, so an object can provide controlled access without exposing the variables themselves. section 2.4
A closure-backed zip code
The zipCode function stores code and location in local variables, then returns accessor functions. After zipCode finishes, princetonZip.code() still reads the retained code, while callers cannot directly access the local variable. section 2.4
The pattern depends on lexical scope: a function retains access to the environment surrounding its declaration, even after the enclosing function has returned. section 2.4











