js中取数组第一个元素

var a=[1,2,2,3,4];
console.log(a);
a.shift();
console.log(a);

(5) [1, 2, 2, 3, 4]

(4) [2, 2, 3, 4]

猜你喜欢

转载自www.cnblogs.com/lch1990/p/10654025.html