mdn array pop code example
Example 1: last element of an array javascript
var myArray = [1, 2, 3, 4];
myArray[myArray.length - 1];
Example 2: pop js
const plants = ['broccoli', 'cauliflower', 'cabbage', 'kale', 'tomato'];
console.log(plants.pop());
console.log(plants);
Example 3: javascript pop
var cars = ['mazda', 'honda', 'tesla'];
var telsa=cars.pop();
Example 4: javascript array pop
let animals = ["dog","cat","tiger"];
animals.pop();
animals.push("elephant");
Example 5: js last array element
var linkElement = document.getElementById("BackButton");
var loc_array = document.location.href.split('/');
var newT = document.createTextNode(unescape(capWords(loc_array[loc_array.length-2])));
linkElement.appendChild(newT);
Example 6: js array.pop
let cats = ['Bob'];
cats.unshift('Willy');
cats.unshift('Puff', 'George');