JavaScript Array unshift()
JavaScript Array unshift()
The unshift() method is used to add new elements to the beginning of an array. It will overwrite the original array.
Syntax:-
Its syntax is:- array.unshift(item1, item2, ..., itemX)
Return:-
Its return is:- new length of the array.
Further Explanation:-
Type | Description |
item1, item2, ..., itemX | The items to add to the array. A minimum of one item is required. |