The _______ method returns the removed item when an element is removed from an array.

  • shift()
  • pop()
  • remove()
  • splice()
The pop() method in JavaScript removes the last element from an array and returns that removed element. It's useful when you need to remove and capture the last item in an array. For instance, let removed = myArray.pop() would remove the last element from myArray and store it in the removed variable.
Add your answer
Loading...

Leave a comment

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