简体   繁体   English

JS传播和休息运算符的运算符优先级?

[英]Operator precedence for JS spread and rest operators?

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我很好奇 Javascript 中 Spread 和 Rest 运算符的优先级是什么: 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.我试图在 MDN 的运算符优先级表( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table )上找到它们,但除非它们是现有运算符的子类别类型,我没有看到他们。 I couldn't find any other obvious documentation about it.我找不到任何其他明显的文档。

Spread syntax is not an operator and therefore does not have a precedence. Spread 语法不是运算符,因此没有优先级。

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.类似地,rest 语法是数组解构和函数参数(和对象解构)语法的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM