Which method removes the last element from an array and returns that element?

  • shift()
  • pop()
  • unshift()
  • splice()
The pop() method in JavaScript is used to remove the last element from an array and return that element. This is commonly used for tasks like removing the last item from a stack implemented as an array. shift() removes the first element, unshift() adds elements to the beginning, and splice() is used for more complex array manipulation.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *