Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

In a given execution context, the Variable object is the Activation object of that execution context. From my research online, I am able to find the previous sentence rephrased in different ways but no one is able to tell what it is.

What is an Activation object?

share|improve this question
    
An activation object is the uppermost object in a scope-chain with the lowermost being global object. See this answer for more details. –  ikaruss Jan 24 at 3:20

1 Answer 1

Let me start from the roots...

Execution context is an object which consists of:

  • variable object, which is activation object in case of functions
  • scope chain, which you can think of as a linked list of outer scopes
  • this value

Variable object is an abstract thing, which can be either one of those:

  • global object (in global context) - the place where global vars (like window, document or console in a browser) reside
  • activation object (for functions, which define scopes in ECMAScript)

Activation object is an object which holds:

  • formal args of the function
  • arguments object for this function
  • any vars and (named) functions inside this function

So, activation object is just a special case of variable object.

It is basically a container for all the local stuff you can access by name inside a function, except for this. I may be imprecise here, but that's what I think it is.

More explainations with some nice pictures:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.