shift
Removes the first element from an array.
list.shift()
shift
removes an element from the front of an array.
import { observe } from "can/everything";
const names = new observe.Array(['Alice', 'Bob', 'Chris']);
console.log(names.shift()); //-> 'Alice'
console.log(names.shift()); //-> 'Bob'
console.log(names.shift()); //-> 'Chris'
console.log(names.shift()); //-> undefined
Returns
{*}
:
The element shifted off from the array, or undefined
if the array is empty
Events
shift
causes length events to be fired.