Array.prototype.shiftbeginnerconst arr = [10, 20, 30]
const first = arr.shift() // β 10
arr // β [20, 30]Use shift() to remove and return the first element of an array.
shift() removes the first element from an array, mutates it, and returns the removed element.
const arr = [1, 2, 3]
const first = arr.shift() // first === 1, arr === [2, 3]