JavaScript Kit > JavaScript Reference > JavaScript Operators: Bitwise
Bitwise Operators
Last updated: March 16th, 2008
Also See: Bitwise Operators precedence and associativity.
Bitwise Operators
Operator | Description |
---|---|
& | Bitwise AND. |
| | Bitwise OR |
^ | Bitwise XOR. |
~ | Bitwise NOT |
<< | Shift left. |
>> | Shift right. |
>>> | Shift right, zero fill. |
Example- Bitwise Operator
This example uses the Bitwise Operator Shift Left to shift the value 2 to the left four bits (binary 10 to binary 1000), resulting in 8:
var test=2;
test=test<<2
alert(test) //alerts 8
Reference List
- JavaScript Operators
- JavaScript Statements
- Global functions
- JavaScript Events
- Escape Sequences
- Reserved Words
Right column