Skip to content
kazuho edited this page Jul 2, 2012 · 21 revisions

The operators of JSX are mostly the same to those in JavaScript (ECMA-262 3rd edition), however some restrictions have been introduced. For example, arithmetic operators only accept numbers (or ints) as their operands.

The table below lists the operators supported by JSX.

List of Operators by Precedence

Operator Returned Type Operand Type(s) Note
(x) typeof x grouping operator
(...) returned type of the called function function call
x.property typeof x.property x:Object
array[index] Nullable.<T> array: Array.<T>, index: number
map[key] Nullable.<T> map: Map.<T>, key: string
x++ typeof x number or int
x-- typeof x number or int
x instanceof y boolean x: Object, y: Class, Interface, Mixin
x as type type cast operator
x as __noconvert__ type type cast operator (without run-time type check)
++x typeof x number or int
--x typeof x number or int
+x typeof x number or int
-x typeof x number or int
~x int number or int
! x boolean any
typeof x boolean variant
x * y number or int number or int int is returned if both operands are int
x / y number or int number or int int is returned if both operands are int
x % y number number or int
x + y string string
x + y number or int number or int int is returned if both operands are int
x - y number or int number or int int is returned if both operands are int
x << y int number or int
x >> y int number or int
x >>> y int number or int
x < y boolean number, int, string
x <= y boolean number, int, string
x > y boolean number, int, string
x >= y boolean number, int, string
x in y boolean x: string, y: Map.<T>
x == y boolean boolean, number, int, string, Object
x != y boolean boolean, number, int, string, Object
x & y int number or int
x ^ y int number or int
x | y int number or int
x && y boolean any
x || y boolean any
x ? y : z typeof y returned types of y and z should be equal
x ?: y typeof x returned types of x and y should be equal
x = y typeof x type of y should be convertible to type of x
x op= y typeof x op can be any of: * / % + - << >> >>> & ^ |
x, y typeof y
Clone this wiki locally