how to push into array javascript code example
Example 1: add item to list javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
Example 2: push array javascript
let array = ["A", "B"];
let variable = "what you want to add";
array.push(variable);
console.log(array);
Example 3: js push array
var array = [];
var element = "anything you want in the array";
array.push(element);
Example 4: javascript push array
const animals = ['pigs', 'goats', 'sheep'];
const count = animals.push('cows');
console.log(count);
console.log(animals);
animals.push('chickens', 'cats', 'dogs');
console.log(animals);