javascript push item to beginning of array
snippet in javascript

javascript push item to beginning of array

user6450

var colors = ["white","blue"];
colors.unshift("red"); //add red to beginning of colors
// colors = ["red","white","blue"]