mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
fix 书写错误
This commit is contained in:
parent
44b4886759
commit
188d9b3af1
@ -289,7 +289,7 @@ let nodeList = document.querySelectorAll('div');
|
|||||||
let array = [...nodeList];
|
let array = [...nodeList];
|
||||||
```
|
```
|
||||||
|
|
||||||
上面代码中,`querySelectorAll`方法返回的是一个`nodeList`对象。它不是数组,而是一个类似数组的对象。这时,扩展运算符可以将其转为真正的数组,原因就在于`NodeList`对象实现了 Iterator 。
|
上面代码中,`querySelectorAll`方法返回的是一个`NodeList`对象。它不是数组,而是一个类似数组的对象。这时,扩展运算符可以将其转为真正的数组,原因就在于`NodeList`对象实现了 Iterator 。
|
||||||
|
|
||||||
对于那些没有部署 Iterator 接口的类似数组的对象,扩展运算符就无法将其转为真正的数组。
|
对于那些没有部署 Iterator 接口的类似数组的对象,扩展运算符就无法将其转为真正的数组。
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user