JavaScript Methods | interactive
☰
back to Array methods
JavaScript Array shift() method
removes the first element from an array and returns that removed
element
shift() method removes the first element from an array and returns that removed element.
shift() method does not accept any parameter.
shift() method decreases the length of the array.
shift() method changes the original array.
shift() will return undefined if array is empty.
syntax description
remove the first element from myArray and return the removed
element
↴
myArray.shift()