The shift() method will return _______ when it is used on an empty array.

  • undefined
  • NaN
  • 0
  • FALSE
The shift() method removes and returns the first element from an array. When used on an empty array, it returns undefined because there are no elements to remove. This behavior allows you to check if an array is empty by evaluating the result of shift().
Add your answer
Loading...

Leave a comment

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