| Execution Context | Syntax of Function Call |
Value of this
|
|---|---|---|
| Global | n/a |
global object (e.g. window)
|
| Function |
Method call:myObject.foo();
|
myObject
|
| Function |
Baseless function call:foo();
|
global object (e.g. window)(undefined in strict mode) |
| Function |
Using call:foo.call(context, myArg);
|
context
|
| Function |
Using apply:foo.apply(context, [myArgs]);
|
context
|
| Function |
Constructor with new:var newFoo = new Foo(); |
the new instance (e.g. newFoo)
|
| Evaluation | n/a |
value of this in parent context
|
| *Taken from "Understanding JavaScript's this" Keybord by Angus Croll | ||