JS drängt auf den Start von 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]
var name = [ "john" ];
name.unshift( "charlie" );
name.unshift( "joseph", "Jane" );
console.log(name);
//Output will be
[" joseph "," Jane ", " charlie ", " john "]
var arr = [23, 45, 12, 67];
arr = [34, ...arr]; // RESULT : [34,23, 45, 12, 67]
console.log(arr)