Array

Example

1

Description

Properties

Property Name Description
constructor function that created the Array object's prototype
length sets or returns the number of elements in an array
prototype allows adding properties and methods to the object

Methods

Method Name Description Values
join() Joins all elements of the Array into a String, and returns the String. If no separator is provided, comma is used.
pop() Removes the last element of the Array, and returns that element.
push() Adds new elements to the end of the Array, and returns the new length.
reverse() Reverses the order of the elements in the Array.
shift() Removes and returns the first element of the Array.
slice() Returns a slice of the Array from the start index to the end index as a new Array.
sort() sorts the Array according to sortFunction.
splice() Adds or removes elements at the specified Array index, modifying the original Array and returning a new Array. If the number to remove is 0, provide elements to be added.
toString() Returns a String representation of the Array.
unshift() Adds new elements to the beginning of the Array.
valueOf() Returns the primitive value of the Array.