Remove last item from array Remove last item from array arrays arrays

Remove last item from array


Array.prototype.pop() by JavaScript convention.

let fruit = ['apple', 'orange', 'banana', 'tomato'];let popped = fruit.pop();console.log(popped); // "tomato"console.log(fruit); // ["apple", "orange", "banana"]


Use splice(startPosition, deleteCount)

array.splice(-1)