Tag Archives: pop method

The pop method

The pop() method is used to remove the last element from an array. If you assign the result of the pop() method to a variable then the popped element will be assigned to the variable.

var Animals = new Array("dogs" , "cats" , "chickens");
var FavoriteAnimal = Animals.pop();
document.write("My favorite animals are "+FavoriteAnimal);

Continue reading