HTML and CSS Reference
The property most used with arrays is the length property, which determines the
number of elements in the array, that is, the size of the array. You can also use this prop-
erty to set the size of an array; for example, if you set the length to 0, all elements of the
array will be removed.
Table 9.1 Array Properties
What It Does
References the object's constructor.
Returns the number of elements in the array.
Extends the definition of the array by adding properties and
var book = new Array() ; // Create an Array object
book = "War and Peace"; // Assign values to elements
book = "Huckleberry Finn";
book = "The Return of the Native";
book = "A Christmas Carol";
book = "The Yearling";
book = "Exodus";
document.write("The book array has " + book.length +
" elements<br />");
document.write("The book's constructor is: "+
book.constructor + "<br />");
document.write("The book has been trashed! The first book is"+
document.write("<br />The size is now "+ book.length );