Mechanics of variables and functions in JavaScript is completely different from most other languages.
Advanced topics become easy to grasp once you know how it works.
with
The with operator allows to use an arbitrary object as the scope. It is used in the code around, but deprecated in modern JavaScript.
LexicalEnvironment
[[Scope]]
new Function
From the previous article, we know that a variable is a property of the LexicalEnvironment object.
Here we discuss access to outer variables and nested functions. In-depth understanding of closures follows automatically.