.shift()

.shift()

  • Removes the first element from an array and returns that removed element

  • This method is a mutating method because it changes the original array


Example

const fruits = ["Apple", "Orange", "Grapes"]

fruits.shift()

console.log(fruits) // Orange, Grapes

JS Bin on jsbin.com