最简单的方法是使用
shift()。如果有数组,该
shift函数会将所有内容向左移动。
var arr = [1, 2, 3, 4]; var theRemovedElement = arr.shift(); // theRemovedElement == 1console.log(arr); // [2, 3, 4]

最简单的方法是使用
shift()。如果有数组,该
shift函数会将所有内容向左移动。
var arr = [1, 2, 3, 4]; var theRemovedElement = arr.shift(); // theRemovedElement == 1console.log(arr); // [2, 3, 4]