android-logo

JavaScript Operators

Table of Content

  • Arithmetic Operators
  • Assignment Operators
  • Comparison (Relational) Operators
  • Logical Operators
  • Bitwise Operators

An operator provides a result by performing an action on a single or more operands .


Arithmetic Operators

OperatorDescriptionExample
+Addition100 + 50 = 150
-Subtraction100 - 50 = 50
*Multiplication100 * 50 = 5000
/Division100 / 50 = 2
%Modulus (Remainder)100 % 50 = 0
++Incrementvar val=2; val++; Now val = 3
--Decrementvar val=2; val--; Now val = 1

Assignment Operators

OperatorDescriptionExample
=Assignx = yx = y
+=Add and assignx += yx = x + y
-=Subtract and assignx -= yx = x - y
*=Multiply and assignx *= yx = x * y
/=Divide and assignx /= yx = x / y
%=Modulus and assignx %= yx = x % y

Comparison Operators

OperatorDescription
==Is equal to
===Is equal value and equal type
!=Is not equal
!==Is not equal value or not equal type
>Is greater than
<Is less than
>=Is greater than or equal to
<=Is less than or equal to
?ternary operator

Logical Operators

OperatorDescription
&&Logical AND
||Logical OR
!Logical Not

Bitwise Operators

OperatorDescription
&AND
|OR
~NOT
^XOR
<<Left shift
>>Right shift
>>>Unsigned right shift

previous-button
next-button

facebook-logo
twitter-logo
instagram-logo

2020 © All rights reserved.