pop array method code example
Example 1: javascript remove last element from array
array.pop();
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.pop();
Example 2: how to remove last element in js
var array = [1, 2, 3, 4, 5, 6];
array.pop();
console.log(array);
Example 3: pop js
const plants = ['broccoli', 'cauliflower', 'cabbage', 'kale', 'tomato'];
console.log(plants.pop());
console.log(plants);
Example 4: javascript pop
var cars = ['mazda', 'honda', 'tesla'];
var telsa=cars.pop();
Example 5: js array.pop
let cats = ['Bob'];
cats.unshift('Willy');
cats.unshift('Puff', 'George');
Example 6: js array.pop
let cats = ['Bob'];
cats.push('Willy');
cats.push('Puff', 'George');