Loading Please Wait...
Comparison operators are used in logical statements to determine equality or difference between variables or values and return either true or false.
JavaScript stores numbers as 64 bits floating point numbers, but all bitwise operations are performed on 32 bits binary numbers.
Operator | Name |
---|---|
& | AND |
| | OR |
~ | NOT |
^ | XOR |
<< | Zero fill left shift |
>> | Signed right shift |
>>> | Zero fill right shift |
Operation | Result |
---|---|
0 & 0 | 0 |
0 & 1 | 0 |
1 & 0 | 0 |
1 & 1 | 1 |
Decimal | Binary |
---|---|
5 | 00000000000000000000000000000101 |
1 | 00000000000000000000000000000001 |
5 & 1 | 00000000000000000000000000000001 (Decimal = 1) |
Operation | Result |
---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
Decimal | Binary |
---|---|
5 | 00000000000000000000000000000101 |
1 | 00000000000000000000000000000001 |
5 | 1 | 00000000000000000000000000000101 (Decimal = 5) |
Operation | Result |
---|---|
0 ^ 0 | 0 |
0 ^ 1 | 1 |
1 ^ 0 | 1 |
1 ^ 1 | 0 |
Decimal | Binary |
---|---|
5 | 00000000000000000000000000000101 |
1 | 00000000000000000000000000000001 |
5 ^ 1 | 00000000000000000000000000000100 (Decimal = 4) |
Operation | Result |
---|---|
~0 | 1 |
~1 | 0 |
Decimal | Binary |
---|---|
5 | 00000000000000000000000000000101 |
~5 | 11111111111111111111111111111010 (Decimal = -6) |
Decimal | Binary |
---|---|
5 | 00000000000000000000000000000101 |
5 << 1 | 00000000000000000000000000001010 (Decimal = 10) |
Decimal | Binary |
---|---|
-5 | 11111111111111111111111111111011 |
-5 >> 1 | 11111111111111111111111111111101 (Decimal = -3) |
Decimal | Binary |
---|---|
5 | 00000000000000000000000000000101 |
5 >>> 1 | 00000000000000000000000000000010 (Decimal = 2) |
How you feel about this blog:
Share this blog on:
If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com
Contact UsWe are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..
Copyright ©
, Lynxsia IT Solutions, All rights reserved