js push add code example
Example 1: javascript array push
var SomeRandomArray = [];
SomeRandomArray.push("Hello, world!");
Example 2: javascript array push
let animals = ["dog","cat","tiger"];
animals.pop();
animals.push("elephant");
Example 3: push javascript
let fruit = ['apple', 'banana']
fruit.push('cherry')
console.log(fruit)
Example 4: javascript push
const animals = ['pigs', 'goats', 'sheep'];
const count = animals.push('cows');
console.log(count);
console.log(animals);
animals.push('chickens', 'cats', 'dogs');
console.log(animals);
Example 5: javascript array push
var fruits = [ "Orange", "Apple", "Mango"];
fruits.push("Banana");
Example 6: .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) ;