Array.prototype.length

Gets or sets the length of the array. This is a number one higher than the highest index in the array.

Syntax

length

Example

[0, 1, 2].length
3
var a = [1]
a.length = 2
a
[1, undefined]