APIs
This page provides API specifications of array.
Properties
.length
Return the number of elements in an array.
Example
Get length of an array
Get the last element in array
Iterate through an array
.length is getter only, cannot assign value for this property.
Methods
.push(value)
Push value to an array
Parameters (1)
value
: any
A value to be pushed
Return value
This method return the index of last pushed value in array.
.pop()
Remove the last element of array
Parameters (0)
Return value
The last element of array.
.shift()
Remove the first element of array.
Parameters (0)
Return value
The first element of array.
Last updated