JavaScript参考手册
Operators
Grouping
圆括号运算符( )
用来控制表达式中的运算优先级.
语法
( )
描述
圆括号运算符由一对圆括号组成,包裹表达式和子表达式用来覆盖常规的 运算符优先级 ,达到低优先级的表达式比高优先级的表达式更早运算.
示例
下面的代码展示了加法运算先于乘法运算的情况.
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
规范
Specification |
Status |
Comment |
---|---|---|
ECMAScript Latest Draft (ECMA-262)The definition of 'The Grouping Operator' in that specification. |
Living Standard |
|
ECMAScript 2015 (6th Edition, ECMA-262)The definition of 'The Grouping Operator' in that specification. |
Standard |
|
ECMAScript 5.1 (ECMA-262)The definition of 'The Grouping Operator' in that specification. |
Standard |
|
ECMAScript 1st Edition (ECMA-262)The definition of 'The Grouping Operator' in that specification. |
Standard |
Initial definition. Implemented in JavaScript 1.0. |
浏览器兼容性
Feature |
Chrome |
Edge |
Firefox (Gecko) |
Internet Explorer |
Opera |
Safari |
---|---|---|---|---|---|---|
Basic support |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
Feature |
Android |
Chrome for Android |
Edge |
Firefox Mobile (Gecko) |
IE Mobile |
Opera Mobile |
Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
(Yes) |
Operators相关
JavaScript 是一种高级编程语言,通过解释执行,是一门动态类型,面向对象(基于原型)的解释型语言。它已经由ECMA(欧洲电脑制造商协会)通过 ECMAScript 实现语言的标准化。它被世界上的绝大多数网站所使用,也被世界主流浏览器( Chrome、IE、FireFox、Safari、Opera )支持。JavaScript 是一门基于原型、函数先行的语言,是一门多范式的语言,它支持面向对象编程,命令式编程,以及函数式编程。它提供语法来操控文本、数组、日期以及正则表达式等,不支持 I/O,比如网络