Appendix C. JavaScript Operator Precedence Chart

This appendix contains the operator precedence chart for JavaScript/ECMAScript (Fig. C.1). The operators are shown in decreasing order of precedence from top to bottom.

Table C.1. JavaScript/ECMAScript operator precedence and associativity.

Operator

Type

Associativity

.

member access

left to right

[]

array indexing

 

()

function calls

 

++

increment

right to left

--

decrement

 

-

unary minus

 

~

bitwise complement

 

!

logical NOT

 

delete

deletes an array element or object property

 

new

creates a new object

 

typeof

returns the data type of its argument

 

void

prevents an expression from returning a value

 

*

multiplication

left to right

/

division

 

%

modulus

 

+

addition

left to right

-

subtraction

 

+

string concatenation

 

<<

left shift

left to right ...

Get Internet & World Wide Web: How to Program, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.