- 拥有 length 属性且索引被当做字符串处理,同时不具备数组所具有的方法这里把这种对象称为伪数组-函数内部的 arguments、DOM 对象列表等
- 伪数组
- 具有length属性
- 按索引方式存储数据
- 不具有数组的push,pop等方法
- 解决办法
解决方法
1. const arr = [].slice.call(htmlCollection);
2. const arr = Array.from(htmlCollection);
3. const arr = [...htmlCollection];
4. const arr = [].slice.call(htmlCollection)