javascript Operators

Symbol
Description
+
Add, 2 + 3 = 5
-
Subtract, 5 - 2 = 3
*
Multiply, 2 * 3 = 6
/
Divide, 6 / 2 = 3
%
Modulus operator, 9%2 = 1
!
Logical operator, Not
||
Logical operator, OR
&&
Logical operator, And
=
Assignment, equal to
+=
e.g. x=10; x += 7; Now x= x + 7 =17
-=
e.g. x=10; x -= 7; Now x= x - 7 =3
*=
e.g. x=10; x *= 7; Now x= x * 7 =70
/=
e.g. x=14; x %= 7; Now x= x % 7 =2
%=
e.g. x=10; x %= 7; Now x= x % 7 =3
<
Comparison operator,Less than
>
Comparison operator,Greater than
<=
Comparison operator,Less than or equal to
>=
Comparison operator,Greater than or equal to
!=
Comparison operator,Not equal to
==
Comparison operator, equal
===
Comparison operator, identical type and value
!==
Comparison operator, not identical
n++
Increment, return original value. e.g. i=2;x=i++; Now x=2, i=3
++n
Increment, return incremented value. i=2;x=++i; Now x=3, i=3
n--
decrement, return original value. e.g. i=2;x=i--; Now x=2, i=1
--n
decrement, return decremented value. i=2;x=--i; Now x=1, i=1
&
Bitwise operator, 2&3=2
|
Bitwise operator, 2|3=3
^
Bitwise operator, 2^3=1
>>
Bitwise operator, 20>>3=2
<<
Bitwise operator, 20<<3=160
>>>
Bitwise operator, 2>>>3=2
&=
Bitwise operator, e.g. x=2; x&=3 = x&3=2
|=
Bitwise operator, e.g. x=20; x|=3; Now x=x|3=23
^=
Bitwise operator, e.g. x=2; x^=3=x^3=1
>>=
Bitwise operator, e.g. x=20; x>>=3 =x>>3=2
<<=
Bitwise operator, e.g. x=20; x<<=3=x<<3=160
>>>=
Bitwise operator, e.g. x=2; x>>>=3=x>>>3=2
endmemo.com © 2017  Terms of Use | Home