导航
×
   ❮   
HTML CSS JavaScript PHP Go Sass W3C Colors ECMS

JS 参考手册

JS 参考手册(字母排序)

JavaScript

JS Arrays JS Boolean JS Classes JS Dates JS Error JS Global JS Iterators JS JSON JS Maps JS Math JS Numbers JS Objects JS Operators JS Assignment JS Arithmetic JS Comparison JS Logical Operators JS Bitwise Operators JS Misc Operators JS Precedence JS Promises JS RegExp Patterns JS RegExp Reference JS Sets JS Statements JS Strings JS Typed Arrays JS Typed Reference

Window

Window Object Window Console Window History Window Location Window Navigator Window Screen

HTML DOM

HTML Documents HTML Elements HTML Attributes HTML Collection HTML NodeList HTML DOMTokenList HTML Styles
alignContent alignItems alignSelf animation animationDelay animationDirection animationDuration animationFillMode animationIterationCount animationName animationTimingFunction animationPlayState background backgroundAttachment backgroundClip backgroundColor backgroundImage backgroundOrigin backgroundPosition backgroundRepeat backgroundSize backfaceVisibility border borderBottom borderBottomColor borderBottomLeftRadius borderBottomRightRadius borderBottomStyle borderBottomWidth borderCollapse borderColor borderImage borderImageOutset borderImageRepeat borderImageSlice borderImageSource borderImageWidth borderLeft borderLeftColor borderLeftStyle borderLeftWidth borderRadius borderRight borderRightColor borderRightStyle borderRightWidth borderSpacing borderStyle borderTop borderTopColor borderTopLeftRadius borderTopRightRadius borderTopStyle borderTopWidth borderWidth bottom boxShadow boxSizing captionSide caretColor clear clip color columnCount columnFill columnGap columnRule columnRuleColor columnRuleStyle columnRuleWidth columns columnSpan columnWidth counterIncrement counterReset cssFloat cursor direction display emptyCells filter flex flexBasis flexDirection flexFlow flexGrow flexShrink flexWrap font fontFamily fontSize fontStyle fontVariant fontWeight fontSizeAdjust height isolation justifyContent left letterSpacing lineHeight listStyle listStyleImage listStylePosition listStyleType margin marginBottom marginLeft marginRight marginTop maxHeight maxWidth minHeight minWidth objectFit objectPosition opacity order orphans outline outlineColor outlineOffset outlineStyle outlineWidth overflow overflowX overflowY padding paddingBottom paddingLeft paddingRight paddingTop pageBreakAfter pageBreakBefore pageBreakInside perspective perspectiveOrigin position quotes resize right scrollBehavior tableLayout tabSize textAlign textAlignLast textDecoration textDecorationColor textDecorationLine textDecorationStyle textIndent textOverflow textShadow textTransform top transform transformOrigin transformStyle transition transitionProperty transitionDuration transitionTimingFunction transitionDelay unicodeBidi userSelect verticalAlign visibility width wordBreak wordSpacing wordWrap widows zIndex

HTML Events

HTML Events HTML Event Objects HTML Event Properties HTML Event Methods

Web APIs

API Canvas API Console API Fetch API Fullscreen API Geolocation API History API MediaQueryList API Storage API Validation API Web

HTML 对象


JavaScript 运算符优先级


优先级描述了算术表达式中运算的执行顺序。

与传统数学一样,乘法运算优先执行:

let x = 100 + 50 * 3;
亲自试一试 »

使用括号时,括号内的运算会先进行计算:

let x = (100 + 50) * 3;
亲自试一试 »

当运算符优先级相同时(例如 + 和 -),它们从左到右进行计算:

let x = 100 / 50 * 3;
亲自试一试 »

运算符优先级

括号内的表达式会在表达式其余部分之前计算。
函数会在表达式的其余部分使用其结果之前执行
运算符 描述 示例
18 ( ) 表达式分组 (100 + 50) * 3
17 . 成员 car.name
17 [] 成员 car["name"]
17 ?. 可选链ES2020 x ?. y
17 () 函数调用 myFunction()
17 new 新建并添加参数 new Date("June 5,2022")
16 new 新建而不带参数 new Date()
递增运算符
后缀递增运算符在前缀递增运算符之前执行。
15 ++ 后缀递增 i++
15 -- 后缀递减 i--
14 ++ 前缀递增 ++i
14 -- 前缀递减 --i
非运算符
14 ! 逻辑非 !(x==y)
14 ~ 位非 ~x
一元运算符
14 + 一元加 +x
14 - 一元减 -x
14 typeof 数据类型 typeof x
14 void 计算 void void(0)
14 delete delete 属性 delete myCar.color
算术运算符
乘方运算乘法运算之前执行
乘法和除法运算加法和减法运算之前执行
13 ** 指数运算ES2016 10 ** 2
12 * 乘法 10 * 5
12 / 除法 10 / 5
12 % 除法余数 10 % 5
11 + 加法 10 + 5
11 - 减法 10 - 5
11 + 连接 "John" + "Doe"
Shift Operators
10 << 左移 x<< 2
10 >> 右移(有符号) x >> 2
10 >>> 右移(无符号) x >>> 2
关系运算符
9 in 对象中的属性 "PI" in Math
9 instanceof 对象实例 x instanceof Array
比较运算符
9 < 小于 x< y 
9 <= 小于或等于 x<= y
9 > 大于 x > y
9 >= 大于或等于 x >= Array
8 == 等于 x == y
8 === 严格相等 x === y
8 != 不相等 x != y
8 !== 严格不相等 x !== y
Bitwise Operators
7 & 按位与 x & y
6 ^ 按位异或 x ^ y
5 | 按位或 x | y
逻辑运算符
4 && 逻辑与 x && y
3 || 逻辑或 x || y
3 ?? Nullish CoalescingES2020 x ?? y
条件(三元)运算符
2 ? : 条件 ? "yes" : "no"
赋值运算符
赋值操作在其他操作之后执行。
2 = 简单赋值 x = y
2 += 加法赋值 x += y
2 -= 减法赋值 x -= y
2 *= 乘法赋值 x *= y
2 **= 指数运算赋值 x **= y
2 /= 除法运算赋值 x /= y
2 %= 余数运算赋值 x %= y
2 <<= 左移赋值 x<<= y
2 >>= 右移赋值 x >>= y
2 >>>= 无符号右移赋值 x >>>= y
2 &= 按位与赋值 x &= y
2 |= 按位或赋值 x |= y
2 ^= 按位异或赋值 x ^= y
2 &&= 逻辑与赋值 x &= y
2 ||= 逻辑或赋值 x ||= y
2 : 冒号赋值 x : 5
2 => 箭头 x => y
2 yield Pause / Resume yield x
2 yield* Delegate yield* x
2 ... Spread ...x
1 , Comma x , y

Copyright ©2020-2026 freew3c.com All Rights Reserved 提供的内容仅用于学习和测试,不保证内容的正确性。