élément JS Array Ajouter
array.push(element)
Common Mynah
array.push(element)
const array1 = ['a', 'b', 'c'];
const array2 = ['d', 'e', 'f'];
const array3 = array1.concat(array2);
var array = [];
var element = "anything you want in the array";
array.push(element); // array = [ "anything you want in the array" ]
array.push(...otherArray)
var fruits = ["Orange", "Apple", "Mango"];
var moreFruits = ["Banana", "Lemon", "Kiwi"];
fruits.push(...moreFruits);
//fruits => ["Orange", "Apple", "Mango", "Banana", "Lemon", "Kiwi"]
const arr = ["foo", "bar"];
arr.push('baz'); // 3
arr; // ["foo", "bar", "baz"]