Skip to content

《Rest 参数与 Spread 语法》中可能存在的问题 #972

Answered by songhn233
smallpigz asked this question in Q&A
Discussion options

You must be logged in to vote

这两种说法是不冲突的。

第一种情况是 在数组中使用 spread 语法,第二种是 在对象字面量中使用 spread 语法

既然提到 MDN 文档的话,其实文档中 也有说明

本教程该章节提到的「Spread 语法只适用于可迭代对象」是在 Array.from[...obj] 的数组上下文的提到的,所以没有问题。

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@smallpigz
Comment options

Answer selected by songhn233
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #971 on November 24, 2021 03:06.