JavaScript mendorong item ke awal array
var colors = ["white","blue"];
colors.unshift("red"); //add red to beginning of colors
// colors = ["red","white","blue"]
Grepper
var colors = ["white","blue"];
colors.unshift("red"); //add red to beginning of colors
// colors = ["red","white","blue"]
let arr = [4, 5, 6]
arr.unshift(1, 2, 3)
console.log(arr);
// [1, 2, 3, 4, 5, 6]
//Add element to front of array
var numbers = ["2", "3", "4", "5"];
numbers.unshift("1");
//Result - numbers: ["1", "2", "3", "4", "5"]