--- title: 圆括号运算符 slug: Web/JavaScript/Reference/Operators/Grouping tags: - JavaScript - Operator - 操作符 translation_of: Web/JavaScript/Reference/Operators/Grouping --- <div>{{jsSidebar("Operators")}}</div> <p>圆括号运算符 <code>( )</code> 用于控制表达式中的运算优先级。</p> <div>{{EmbedInteractiveExample("pages/js/expressions-groupingoperator.html")}}</div> <p class="hidden">这些交互的事例资源都是基于Github的仓库.如果你想提交更多的交互事例,请克隆这个url<a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> 并且向我们发送合并请求。</p> <h2 id="语法">语法</h2> <p>译者:下列语法是 MDN 上已知的最简单的之一。</p> <pre class="syntaxbox"> ( )</pre> <h2 id="说明">说明</h2> <p>圆括号运算符由一对圆括号组成,包裹表达式和子表达式用来覆盖常规的<a href="/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence">运算符优先级</a>,达到低优先级的表达式比高优先级的表达式更早运算。</p> <h2 id="示例">示例</h2> <p>下面的代码展示了加法运算先于乘法运算的情况。</p> <pre class="brush:js">var a = 1; var b = 2; var c = 3; // default precedence a + b * c // 7 // evaluated by default like this a + (b * c) // 7 // now overriding precedence // addition before multiplication (a + b) * c // 9 // which is equivalent to a * c + b * c // 9 </pre> <h2 id="规范">规范</h2> <table class="standard-table"> <tbody> <tr> <th scope="col">Specification</th> <th scope="col">Status</th> <th scope="col">Comment</th> </tr> <tr> <td>{{SpecName('ESDraft', '#sec-grouping-operator', 'The Grouping Operator')}}</td> <td>{{Spec2('ESDraft')}}</td> <td> </td> </tr> <tr> <td>{{SpecName('ES6', '#sec-grouping-operator', 'The Grouping Operator')}}</td> <td>{{Spec2('ES6')}}</td> <td> </td> </tr> <tr> <td>{{SpecName('ES5.1', '#sec-11.1.6', 'The Grouping Operator')}}</td> <td>{{Spec2('ES5.1')}}</td> <td> </td> </tr> <tr> <td>{{SpecName('ES1', '#sec-11.1.4', 'The Grouping Operator')}}</td> <td>{{Spec2('ES1')}}</td> <td>初始化定义.在JavaScript1.0中生效</td> </tr> </tbody> </table> <h2 id="浏览器兼容性">浏览器兼容性</h2> <p>{{Compat("javascript.operators.grouping")}}</p> <h2 id="See_also" name="See_also">相关链接</h2> <ul> <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence">运算符优先级</a></li> <li>{{jsxref("Operators/delete", "delete")}}</li> <li>{{jsxref("Operators/typeof", "typeof")}}</li> </ul>