Adds one or more elements to the beginning of an array.
Syntax
arr.unshift(...elements)Example
Enter values below to update the example in real time.
const→arr→unshift→console→const arr = [3, 4, 5];
arr.unshift(1, 2);
console.log(arr); // [1, 2, 3, 4, 5]