Removes the last element from an array and returns that element.
Syntax
arr.pop()Example
Enter values below to update the example in real time.
const→stack→pop→console→const stack = [1, 2, 3];
const last = stack.pop();
console.log(last); // 3
console.log(stack); // [1, 2]