Learn how to remove the last element from an array in JavaScript using the pop() method.
In this quick tutorial, you will learn:
What the JavaScript pop() method does
How to remove the last element from an array
What value the pop() method returns
Example:
const array = [1, 2, 3, 4, 5];
// console.log(array);
array.push(6);
// console.log(array);
array.push(7, 8, 9);
// console.log(array);
array.pop();
console.log(array);
array.pop();
console.log(array);