The shift()
method removes the first element of an array.
In the example given above,
sports.shift()
removes the first element "Football"
from the array sports
.
The shift()
method also returns the element that was removed,
as shown in the example below.