- Notifications
You must be signed in to change notification settings - Fork1.2k
-
在《Rest 参数与 Spread 语法》章节中介绍说明 在该叙述下面的例子中用到 Spread 语法复制对象 在前面的章节《Iterable **object(可迭代对象)》中介绍了普通对象不是迭代对象 所以对红框中的描述有点疑惑,找了MDN。 大佬们,这个地方是否存在歧义😂 |
BetaWas this translation helpful?Give feedback.
All reactions
Answered by songhn233Nov 23, 2021
这两种说法是不冲突的。
第一种情况是在数组中使用 spread 语法,第二种是在对象字面量中使用 spread 语法。
既然提到 MDN 文档的话,其实文档中也有说明。
本教程该章节提到的「Spread 语法只适用于可迭代对象」是在Array.from 和[...obj] 的数组上下文的提到的,所以没有问题。
Replies: 1 comment 1 reply
-
这两种说法是不冲突的。 第一种情况是在数组中使用 spread 语法,第二种是在对象字面量中使用 spread 语法。 既然提到 MDN 文档的话,其实文档中也有说明。 本教程该章节提到的「Spread 语法只适用于可迭代对象」是在 |
BetaWas this translation helpful?Give feedback.
All reactions
1 reply
-
明白了,谢谢解答😄 |
BetaWas this translation helpful?Give feedback.
All reactions
Answer selected bysonghn233
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A Labels
None yet
Converted from issue
This discussion was converted from issue #971 on November 24, 2021 03:06.



