Array Built-in Methods
The JavaScript Array object defines a number of methods you can use to work with arrays.
Method | Description | Returns |
---|---|---|
concat(<otherArray>) | Concatenates the array with the specified array. Multiple arrays can be specified. | Array |
join(<separator>) | Joins all of the elements in the array to form a string. The argument specifies the character used to delimit the items. | string |
pop() | Treats an array like a stack, and removes and returns the last item in the array. | object |
push(<item>) | Treats an array like a stack, and appends the specified item to the array. | void |
reverse() | Reverses the order of the items in the array in place. | Array |
shift() | Like pop, but operates on the first element in the array. | object |
slice(<start>,<end>) | Returns a sub-array. | Array |
sort() | Sorts the items in the array in place. | Array |
unshift(<item>) | Like push, but inserts the new element at the start of the array. | void |
Home
JavaScript Book
Essential Types
JavaScript Book
Essential Types
Array:
- The Array Type
- Array Built-in Methods
- Detecting Arrays
- Get and set array values
- Enumerating the Contents of an Array
- Array Length
- Array join() method
- Array concat()
- Array indexOf()
- Array lastIndexOf()
- Array every()
- Array filter() filters array with the given function.
- Array map()
- Array forEach()
- push() and pop():Array Stack Methods
- push(), shift():Array Queue Methods
- Array reduce()
- Array reduceRight()
- reverse():Reordering array
- Array slice()
- Array some()
- Array splice()
- Array sort()
- toString(), toLocaleString() and valueOf Array
- Array unshift()