You can add your own properties to a function object. These can then be used as static variables inside the function. Since the function object persists, so do its properties. Variables declared inside the function with a var statement only persist while the function context is called and present in the scope chain.
See also: | Static method, Static variable |
Prev | Home | Next |
Function.valueOf() | Up | Function property |
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. |