JavaScript Array Properties

About This Index
This page is the JavaScript Array Properties index for the tutorial track. The property you will use every day is length. Elements are not named fields; you read them with an index or a method.
Learn what an Array is on /js/array. Functions such as push() and map() live on the Array Methods index.
colors.length is a number. colors.push("gold") is a method, so it needs parentheses. colors.length() throws.
How to Read an Array Property
Properties are values. No parentheses:
const colors = ["red", "green", "blue"];
colors.length; // 3
colors.constructor === Array; // true
Array.prototype.push; // the method function
Array.length; // 1
Array.name; // "Array" JavaScript Array Properties Table
Properties on an array value and on the Array function (4 entries). length counts items. Array.length is the constructor’s argument count.
Instance properties
2 propertiesRead these on an array you created with [] or new Array().
| Property | Description | Guide |
|---|---|---|
length | The count of elements. colors.length is 3 for three items. Assigning a smaller length drops items from the end. | Open |
constructor | The function that created the array. For an array literal, constructor is Array. | Open |
Static properties
2 propertiesRead these on Array itself.
| Property | Description | Guide |
|---|---|---|
prototype | Shared object where push(), map(), filter(), and the other array methods live. | Open |
[Symbol.species] | Constructor used to create derived objects from Array methods that return new arrays. | Open |
Frequently Asked Questions
Change the list with methods
length counts items. push(), map(), and filter() do the work.
CODETOFUN NEWS
Stay Ahead in Tech
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
8 people found this page helpful
