Unshift

The unshift method adds new elements sequentially to the start, or front of the array. For example.

let array = [0, 5, 10];
array.unshift(-5); 

// RESULT: array = [-5 , 0, 5, 10];

Last updated

Was this helpful?