.pop() removes and returns the last array value.
const sizes = ["S", "M", "L"];
const removed = sizes.pop();
console.log(removed); // outputs "L"
console.log(sizes.length); // outputs 2Predict the output
A packing list removes its final item. Predict both the removed item and the number left.
const items = ["book", "pen", "lamp"];
const removedItem = items.pop();
console.log("Removed:", removedItem);
console.log("Remaining:", items.length);