The unshift method adds new elements sequentially to the start, or front of the array. For example.
unshift
let array = [0, 5, 10]; array.unshift(-5); // RESULT: array = [-5 , 0, 5, 10];
The unshift() method overwrites the original array.
unshift()
Last updated 3 years ago