Properties
Array properties or characteristics are a way to describe the attributes of the array. Examples include: the total number of elements, the value at a particular index, etc…
Here is a list of the properties of the Array object along with their description.
Constructor()
Returns a reference to the array function that created the object.
Syntax:
arrayName.constructor;
Example:
Index()
The property represents the zero-based index of the match in the string. Index provides a way to access or modify elements based on their position in the array.
Access an array element by index:
Syntax:
var value = arrayName[index];
Example:
Modify an array element by index:
Syntax:
arrayName[index] = newValue;
Example:
Length()
Reflects the number of elements in an array.
Syntax:
var length = arrayName.length;
Example: