返回列表

javascript删除数组元素

默认分类 2011-12-16 04:59:39

方法一 var list = [1,2,3,4,5,6]; list.splice(3-1,1); alert(list);

方法二 var a,b,c,list = [1,2,3,4,5,6]; a = list.concat([]); a.unshift("");a.push(""); b = a.concat().splice(0,i); c = a.concat().splice(i+1,a.length-(i+1)); b = b.concat(c); b.pop();b.shift(); list = b; alert(list);