Simple example of pushing to the front of an array in javascript.
const soda = ["coke", "sprite", "fanta"];
const length = soda.unshift("root beer");
console.log(soda);
// output: ["root beer", "coke", "sprite", "fanta"]
unshift
adds one of more items to the beginning of the array.Here’s an example of pushing multiple items to the front of an array:
const food = ["hamburger", "hot dog"];
const length = food.unshift("pizza", "steak", "grilled cheese");
console.log(food);
// output: ["pizza", "steak", "grilled cheese", "hamburger", "hot dog"]
For other javascript examples: https://www.mikesallese.me/tags/javascript