JavaScript Operators

Category Operator Description Usage Example Value/Result
String + concatenation "Java" + "Script"
Arithmetic + addition 2 + 3
- subtraction 6 - 4
unary negation -9
* multiplication 3 * 4
/ division 15/3
% modulus 15%7
++ increment and then return value x=3; ++x
return value and then increment x=3; x++
-- decrement and then return value x=3; --x
return value and then decrement x=3; x--
Bit Manipulation & and 10 & 7
| or 10 | 7
^ exclusive or 10 ^ 7
<< left shift 7 << 3
>> sign-propagating right shift -7 >> 2
>>> zero-fill right shift -7 >>> 2
Logical && logical and true && false
|| logical or true || false
! not !true
Comparison == equal 3 == 7
!= not equal 3 != 7
< less than 3 < 7
<= less than or equal 3 <= 7
> greater than 3 > 7
>= greater than or equal 3 >= 7
Conditional Expression (condition) ? value1 : value2 if condition is true then value1 else value2 true ? 3 : 7