To remove last item from array with JavaScript, we use the pop method.
For instance, we write
const fruit = ["apple", "orange", "banana", "tomato"];
const popped = fruit.pop();
to call fruit.pop to remove the last element in fruit and return it.
