An unsigned, 32-bit integer that specifies the number of elements in an array.
Property of Array
Description
The value of the length property is an integer with a positive sign and a value less than 2 to the 32nd power (2^32^).
You can set the length property to truncate an array at any time. When you extend an array by changing its length property, the number of actual elements does not increase; for example, if you set length to 3 when it is currently 2, the array still contains only 2 elements.
Examples
In the following example, the getChoice function uses the length property to iterate over every element in the musicType array. musicType is a select element on the musicForm form.
The following example shortens the array statesUS to a length of 50 if the current length is greater than 50.