1. Definition and usage
The unshift () method adds one or more elements to the beginning of the array and returns the new length.
grammar:
array.unshift(item1,item2, ..., itemX)
Parameters: item1 , item2 , ..., itemX add one or more elements to the beginning of the array.
Note: This method will change the number of arrays
Examples:
var arr = [1,2,3,4,5]; arr.unshift(6,7,8); console.log(arr);
Output: