array.psuh code example
Example 1: js array add element
array.push(element)
Example 2: add value to array javascript
var fruits = ["222", "vvvv", "eee", "eeee"];
fruits.push("Kiwi");
Example 3: javascript add element to array
const langages = ['Javascript', 'Ruby', 'Python'];
langages.push('Go');
const dart = 'Dart';
langages = [...langages, dart];
Example 4: .push js
let monTableau2D = [
['Mark' , 'jeff' , 'Bill'] ,
['Zuckerberg' , 'Bezos' , 'Gates']
] ;
monTableau2D[1].push('test') ;
console.log(monTableau2D) ;
let monTableau = ['un', 'deux','trois', 'quatre'] ;
monTableau.push('cinq') ;
console.log(monTableau) ;
let monTableauAssociatif = {
'prenom' : 'Mark' ,
'nom' : 'Zuckerberg' ,
'poste' : 'Pdg de Facebook',
} ;
monTableauAssociatif['nationalite'] = 'Américaine' ;
console.log(monTableauAssociatif) ;