a=[5,4,3,2,1]; everyother=a.filter(function(x,i){return i%2==0}); console.log(everyother,a) //[4, 2] [5, 4, 3, 2, 1]
原文链接:https://blog.csdn.net/yjf997234900/article/details/38312885