1

I've been reading on topics of scope & context and found this article. The explanations are mostly distinct combined with what I've read on other resources, however there's one line that's confusing me.

Fundamentally, scope is function-based while context is object-based. In other words, scope pertains to the variable access of a function when it is invoked and is unique to each invocation.

What does he mean here? How can a scope be unique, since it's static (lexical)? Isn't it the execution context that's dynamic, being created on each new invocation, while function scope remains the same?

Calster
  • 21
  • 3
  • I think you might want to find some better explanations. That post has a variety of issues. (Your last paragraph is a good example; *scope* is static, but what's available in variables in scope is determined by invocations (the "closure").) – Pointy Jul 14 '20 at 18:37
  • 1
    I suggest you read about scope from [this resource](https://github.com/getify/You-Dont-Know-JS/blob/2nd-ed/scope-closures/README.md) – Yousaf Jul 14 '20 at 18:40
  • 2
    @Pointy That's what I was thinking. Dmitry Soshnikov's series of posts on EcmaScript made more sense to me and I found no contradictions there. It's just a I had some doubts left if I got everything right. – Calster Jul 14 '20 at 18:50

0 Answers0