I am reading Secrets of the Javascript Ninja and am trying to figure out where the closure variables of a function are stored.[[Environment]]
property available on the function identifier:
Whenever a function is created, a reference to the lexical environment in which the function was created is stored in an internal (meaning that you cannot access or manipulate it directly) property named [[Environment]] (this is the notation that we’ll use to mark these internal properties). In our case, the skulk function will keep a reference to the global environment, and the report function to the skulk environment.
All I see on my function is [[Scopes]]
, which contains the closure scope:
I have two questions:
- Is
[[Environment]]
a Node.js thing and the equivalent of[[Scopes]]
on the front end? - Is this the best place to check for any closure data on a function?