Last updated 2 years ago
Was this helpful?
JS โฉ object โฉ built-in โฉ Array โฉ length
array length is automatically maintained by the array.
if you assign a[i] = value, where i โฅ a.length, a.length is set to i+1.
a[i] = value
i+1
if you set a.length = n, where n < a.length, then any elements whose index โฅ n are deleted.
a.length = n
JavaScript: The Definitive Guide > 7.4 Array Length