shift()
shift()方法从数组中删除第一个元素并返回该元素。
语法 (Syntax)
array.shift();
返回值 (Return Value)
返回已删除的数组的单个值。
例子 (Example)
var arr = [10, 1, 2, 3].shift();
console.log("Shifted value is : " + arr )
输出 (Output)
Shifted value is : 10
shift()方法从数组中删除第一个元素并返回该元素。
array.shift();
返回已删除的数组的单个值。
var arr = [10, 1, 2, 3].shift();
console.log("Shifted value is : " + arr )
Shifted value is : 10