【前端】三种复制数组的方法
// 三种数组复制方法
// 1. by slice
var arr = [1, 2, 3], copyArr;
copyArr = arr.slice();
// 2. by concat
var arr = [1, 2, 3], copyArr;
copyArr = arr.concat();
// 3. by loop
var arr = [1, 2, 3], copyArr = [];
for (var i = 0; i < arr.length; ++i) {
copyArr.push(arr[i]);
}