最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Operator precedence for JS spread and rest operators? - Stack Overflow

programmeradmin4浏览0评论

I'm curious what the precedence of the Spread and Rest operators are in Javascript:

I was trying to find them on MDN's Operator Precedence table () but unless they are a subcategory of an existing operator type, I don't see them. I couldn't find any other obvious documentation about it.

I'm curious what the precedence of the Spread and Rest operators are in Javascript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator

I was trying to find them on MDN's Operator Precedence table (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table) but unless they are a subcategory of an existing operator type, I don't see them. I couldn't find any other obvious documentation about it.

Share Improve this question asked Feb 7, 2018 at 5:02 Scotty WaggonerScotty Waggoner 3,3802 gold badges29 silver badges41 bronze badges 2
  • 1 It had been part of that table since 2014 but I fixed it last month :-) – Bergi Commented Feb 7, 2018 at 5:10
  • @Bergi: thank you! I can’t believe someone added that to the table o_O but who knows, things were still in flux in 2014 – Felix Kling Commented Feb 7, 2018 at 15:52
Add a comment  | 

1 Answer 1

Reset to default 21

Spread syntax is not an operator and therefore does not have a precedence.

It is part of the array literal and function call (and object literal) syntax.

Similarly, rest syntax is part of the array destructuring and function parameter (and object destructuring) syntax.

发布评论

评论列表(0)

  1. 暂无评论