javascript put head array code example
Example 1: javascript add new array element to start of array
var colors = ["white","blue"];
colors.unshift("red"); //add red to beginning of colors
// colors = ["red","white","blue"]
Example 2: .unshift
let monTableau = ['un', 'deux','trois', 'quatre'] ;
monTableau.unshift('zero') ;
//console.log(monTableau) ;
let monTableau2D = [
['Mark' , 'jeff' , 'Bill'] ,
['Zuckerberg' , 'Bezos' , 'Gates']
] ;
monTableau2D[1].unshift('test') ;
//console.log(monTableau2D) ;