javascriptコピー配列
463 ワード
var a = [0,1,2];
var b = a.slice(0);
b[0] = 666;
console.log(a[0]);// 0
var a = [];
b
$.each(b,function(index,item){
a.push(item.slice(0));
});
console.log(a[0][0] === b[0][0]);//false