push java script code example
Example 1: push javascript
let fruit = ['apple', 'banana']
fruit.push('cherry')
console.log(fruit)
Example 2: 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 3: push javascript
let twentyThree = 'XXIII';
let romanNumerals = ['XXI', 'XXII'];
romanNumerals.push(twentyThree);
romanNumerals.unshift('XIX', 'XX');