js .push method code example
Example 1: push array javascript
let array = ["A", "B"];
let variable = "what you want to add";
array.push(variable);
console.log(array);
Example 2: javascript array push
var SomeRandomArray = [];
SomeRandomArray.push("Hello, world!");
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: js push
let arr = [9, 4, 3, 18]
arr.push(30)
console.log(arr)