“.unshift” Kode Jawaban

JavaScript menambahkan elemen array baru untuk memulai array

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

.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) ; 
Crevure 01

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya