A definition is a declaration that also allocates storage for the item being declared.
For example:
new Array();
creates an empty Array object. As there is no indication of the likely size the array will require, no storage is allocated for array elements.
Now consider this:
new Array(10);
new Array("aaa", "bbb", "ccc");
Each of these declarations require some storage to be allocated. In the first entry, space for 10 elements is reserved in the array. In the second, there are three element pointers created and the storage for the three items as well.
Thus we have a definition.
Prev | Home | Next |
Defensive coding | Up | DEL object |
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. |