auf ein Array drängen
array = ["hello"]
array.push("world");
console.log(array);
//output =>
["hello", "world"]
array = ["hello"]
array.push("world");
console.log(array);
//output =>
["hello", "world"]
array = ["hello"]
array.push("world");
let array = ["A", "B"];
let variable = "what you want to add";
//Add the variable to the end of the array
array.push(variable);
//===========================
console.log(array);
//output =>
//["A", "B", "what you want to add"]
var array = [];
var element = "anything you want in the array";
array.push(element); // array = [ "anything you want in the array" ]
var vegetables = ['Capsicum',' Carrot','Cucumber','Onion'];
vegetables.push('Okra');
//expected output ['Capsicum',' Carrot','Cucumber','Onion','Okra'];
// .push adds a thing at the last of an array
const arr = ["foo", "bar"];
arr.push('baz'); // 3
arr; // ["foo", "bar", "baz"]