What is SpreadElement in ECMAScript documentation? Is it the same as Spread syntax at MDN?

后端 未结 2 1090
醉酒成梦
醉酒成梦 2020-11-21 06:55

At ECMAScript specification the SpreadElement is described

SpreadElement[Yield]:
...AssignmentExpression[In, ?Yield]

Is this the same as th

2条回答
  •  被撕碎了的回忆
    2020-11-21 08:01

    SpreadElement is just a name in the ES6 grammar for spread "operator" together with its argument when in an Array literal:

    SpreadElement[Yield]:
        ... AssignmentExpression[In, ?Yield]
    

    So, SpreadElement in [a, b, ...c] is ...c; spread "operator" is .... (scare quotes because it is not a real operator in the same sense that, e.g. - is.)

    The name of the grammar rule being used in function calls will be different, as it is a different grammatical context (it's just one kind of ArgumentList).

提交回复
热议问题