bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/JavaScript/Debugging, Projects, and Reference
JavaScript•Debugging, Projects, and Reference

JavaScript Operator Precedence

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind JavaScript Operator Precedence?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ x = 100 + 50 * 3;
3Order

Put the learning moves in the order that makes the concept easiest to apply.

Multiplication ( * ) and division ( / ) have higher precedence than addition ( + ) and subtraction ( - ).
Operator precedence describes the order in which operations are performed in an arithmetic expression.
Order of Operation

Order of Operation

Operator precedence describes the order in which operations are performed in an arithmetic expression.

Multiplication ( * ) and division ( / ) have higher precedence than addition ( + ) and subtraction ( - ).

Examples

let x = 100 + 50 * 3;
Operator Precedence Values Expressions in parentheses are computed before the rest of the expression Functions are executed before the result is used in the rest of the expression
18( )Expression Grouping(100 + 50) * 3
17.Member Ofperson.name
17[]Member Ofperson["name"]
17?.Optional Chaining ES2020x ?. y
17()Function CallmyFunction()
17newNew with Argumentsnew Date("June 5,2022")
16newNew without Argumentsnew Date()
Increment Operators Postfix increments are executed before prefix increments
15++Postfix Incrementi++
15--Postfix Decrementi--
14++Prefix Increment++i
14--Prefix Decrement--i
NOT Operators
14!Logical NOT!(x==y)
14~Bitwise NOT~x
Unary Operators
14+Unary Plus+x
14-Unary Minus-x
14typeofData Typetypeof x
14voidEvaluate Voidvoid(0)
14deleteProperty Deletedelete myCar.color
Arithmetic Operators Exponentiations are executed before multiplications Multiplications and divisions are executed before additions and subtractions
13**Exponentiation ES201610 ** 2
12*Multiplication10 * 5
12/Division10 / 5
12%Division Remainder10 % 5
11+Addition10 + 5
11-Subtraction10 - 5
11+Concatenation"John" + "Doe"
Shift Operators
10<<Shift Leftx << 2
10>>Shift Right (signed)x >> 2
10>>>Shift Right (unsigned)x >>> 2
Relational Operators
9inProperty in Object"PI" in Math
9instanceofInstance of Objectx instanceof Array
Comparison Operators
9<Less thanx < y
9<=Less than or equalx <= y
9>Greater thanx > y
9>=Greater than or equalx >= Array
8==Equalx == y
8===Strict equalx === y
8!=Unequalx != y
8!==Strict unequalx !== y
Bitwise Operators
7&Bitwise ANDx & y
6^Bitwise XORx ^ y
5Bitwise ORxy
Logical Operators
4&&Logical ANDx && y
3Logical ORxy
3??Nullish Coalescing ES2020x ?? y
Conditional (ternary) Operator
2? :Condition? "yes" : "no"
Assignment Operators Assignments are executed after other operations
2=Simple Assignmentx = y
2:Colon Assignmentx: 5
2+=Addition Assignmentx += y
2-=Subtraction Assignmentx -= y
2*=Multiplication Assignmentx *= y
2**=Exponentiation Assignmentx **= y
2/=Division Assignmentx /= y
2%=Remainder Assignmentx %= y
2<<=Left Shift Assignmentx <<= y
2>>=Right Shift Assignmentx >>= y
2>>>=Unsigned Right Shiftx >>>= y
2&=Bitwise AND Assignmentx &= y
2=Bitwise OR Assignmentx= y
2^=Bitwise XOR Assignmentx ^= y
2&&=Logical AND Assignmentx &&= y
2=Logical OR Assignmentx= y
2=>Arrowx => y
2yieldPause / Resumeyield x
2yield*Delegateyield* x
2...Spread... x
1,Commax , y

Previous

JavaScript Debugging Breakpoints

Next

Project - To-Do List