From 06e16fe5290a1cc2b674dcca45c1e7f549ce46b8 Mon Sep 17 00:00:00 2001 From: yuwei Date: Sun, 3 Jan 2016 21:40:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=A9=E5=B1=95=E8=BF=90?= =?UTF-8?q?=E7=AE=97=E7=AC=A6=E5=BA=94=E7=94=A85=E7=9A=84=E5=86=99?= =?UTF-8?q?=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 详情以及建议见 https://github.com/ruanyf/es6tutorial/issues/111。 5)类似数组的对象 任何类似数组的对象,都可以用扩展运算符转为真正的数组。 var nodeList = document.querySelectorAll('div'); var array = [...nodeList]; 这里明显有问题,对于扩展运算符,只能对于可遍历(iterable)的对象 MDN The spread operator allows an expression to be expanded in places where multiple arguments (for function calls) or multiple elements (for array literals) are expected. --- docs/function.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/function.md b/docs/function.md index 18e0331..7fcc187 100644 --- a/docs/function.md +++ b/docs/function.md @@ -594,9 +594,9 @@ str.split('').reverse().join('') 上面代码中,如果不用扩展运算符,字符串的`reverse`操作就不正确。 -**(5)类似数组的对象** +**(5)实现了Iterator接口的对象** -任何类似数组的对象,都可以用扩展运算符转为真正的数组。 +任何Iterator接口的对象,都可以用扩展运算符转为真正的数组。 ```javascript var nodeList = document.querySelectorAll('div');