concept lexical environment in category javascript
appears as: lexical environments, lexical environment, A lexical environment

This is an excerpt from Manning's book Secrets of the JavaScript Ninja, Second Edition.
Figure 5.17. The state of execution contexts and lexical environments when performing the ninja2.getFeints() call. A new getFeints environment is created that has the environment of the constructor function in which ninja2 was created as its outer environment. getFeints can access the “private” feints variable.
![]()
The three types of variable definitions—var, let, and const—can also be categorized by their relationship with the lexical environment (in other words, by their scope). In that case, we can put var on one side, and let and const on the other.