Hello, I’m little bit confused about Lexical Scope...
# general
b
Hello, I’m little bit confused about Lexical Scope vs Lexical Environment in JavaScript. In this following code:
Copy code
function doSomething() {
  var age = 7;
  // Some more code
 }
What are the lexical scope and lexical environment of
age
variable? Are they same? As far as I know, Lexical Scope is the place that is defined any variable, function, or expression. What’s the difference from Lexical Environment? With this Lexical Scope knowledge, we are able to know which scope can access to age variable, and age variable can access which scope as well. Am I right? What do you think?
t
This question is off topic for this slack space, which is for questions about pact.
👍 1
For the answer to your question, this blog post looks like a reasonable summary (I didn't read it closely)
b
Thank you @Timothy Jones 👍