unshift < Array < JavaScript
The unshift() method of an array adds element(s) to the beginning of the array.
const days = ['Mon', 'Tues', 'Wed'];
days.unshift('Fri');
console.log(days);
// ["Fri", "Mon", "Tues", "Wed"]
The unshift() method of an array adds element(s) to the beginning of the array.
const days = ['Mon', 'Tues', 'Wed'];
days.unshift('Fri');
console.log(days);
// ["Fri", "Mon", "Tues", "Wed"]