what is array unshift code example
Example 1: unshift method in javascript
var name = [ "john" ];
name.unshift( "charlie" );
name.unshift( "joseph", "Jane" );
console.log(name);
//Output will be
[" joseph "," Jane ", " charlie ", " john "]
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) ;