Computer >> Computer tutorials >  >> Programming >> Javascript

Removing an element from the end of the array in Javascript


Removing an element from the end of the array

This can be accomplished using the pop method. For example,

Example

let veggies = ["Onion", "Raddish"];
veggies.pop();
console.log(veggies);

Output

This will give the output −

["Onion"]