| Availability: |
| |||
| JavaScript syntax: | N | myClosure = new Closure() | ||
| Object properties: | __parent__, __proto__ | |||
This is a special kind of object, which maintains some contextual state information when it is created.
It can behave like a function, but is a kind of function wrapper that references a function and a scope. Since it inherits everything from the Function object, it can behave like a function and can be called as such.
Because it also stores the scope chain at the time it is manufactured, it can restore that scope chain when it is executed.
| See also: | Lexical scoping |
| Property | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
|---|---|---|---|---|---|---|---|---|---|---|---|
| __parent__ | 1.2 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
| __proto__ | 1.2 ![]() | ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | - |
| Prev | Home | Next |
| closed | Up | Closure() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. | ||