JavaScript – Remove Last Element of Array

To remove last element of an array in JavaScript, call pop() method on this array. pop() method modifies the original array, and returns the removed element.

arr.pop()

Example

In the following example, we have taken an array in arr. We remove the last element from this array using pop() method.

index.html

ADVERTISEMENT

Conclusion

In this JavaScript Tutorial, we learned how to remove last element of an array using pop() method.