The pop() method removes the last element from an array and returns _______.

  • the popped element
  • the new array length
  • undefined
  • NaN
The pop() method in JavaScript removes the last element from an array and returns the removed element. If the array is empty, pop() returns undefined. It is commonly used to remove and retrieve the last element in a stack-like fashion from the end of an array.
Add your answer
Loading...

Leave a comment

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