数组处理

1. 复制数组

// 使用扩展运算符 ...
const itemsCopy [...items];

 

2. 添加元素

someStack.push('newData');

 

3. 把类数组对象转换成数组

const foo = document.querySelectorAll('.foo');
const nodes = Array.from(foo);
posted @ 2019-09-17 14:23  iceCream-Lling  阅读(140)  评论(0编辑  收藏  举报