concept lexical environment in category javascript

appears as: lexical environments, lexical environment, A lexical environment
Secrets of the JavaScript Ninja, Second Edition

This is an excerpt from Manning's book Secrets of the JavaScript Ninja, Second Edition.

5.4. Keeping track of identifiers with lexical environments

A lexical environment is an internal JavaScript engine construct used to keep track of the mapping from identifiers to specific variables. For example, consider the following code:

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.

5.5.2. Variable definition keywords and lexical environments

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.

sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest