Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

Array: length

2 tags 1 category

The length data property of an Array instance represents the number of slots in that array. The value is an unsigned, 32-bit integer that is always numerically greater than the highest index in the array. It may be greater than the number of elements if the array is sparse.

The value of the length property is a nonnegative integer with a value less than 232.

The array object observes the length property, and automatically syncs the length value with the array’s content. This means:

Setting length to a value smaller than the current length truncates the array — elements beyond the new length are deleted. Setting any array index (a nonnegative integer smaller than 232) beyond the current length extends the array — the length property is increased to reflect the new highest index. Setting length to an invalid value (e.g., a negative number or a non-integer) throws a RangeError exception.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…