1、复制 […arr]、concat
let arr = [1, 2];
let arr1 = [...arr]; //ES6
let arr2 = [].concat(arr);
2、把类似数组的对象转为数组 Array.from;
如:
let obj = $('div');
let arr = Array.from(obj);
1、复制 […arr]、concat
let arr = [1, 2];
let arr1 = [...arr]; //ES6
let arr2 = [].concat(arr);
2、把类似数组的对象转为数组 Array.from;
如:
let obj = $('div');
let arr = Array.from(obj);
转载于:https://www.cnblogs.com/Zting00/p/7497675.html