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
Last updated 3 years ago