Bitwise operator (Definition)

An operator that is applied in a bitwise manner.

Availability:

ECMAScript edition - 2
Property/method value type:Number primitive

Bitwise operators convert both operands to 32 bit integers and apply the operator to them on a bit-by-bit basis.

Here is a table of all operators in the bitwise category and those that are members of other categories but perform bitwise operations:

OpDescription
~Bitwise complement (NOT)
&Bitwise AND
<<Bitwise left shift
>>Bitwise right shift
>>>Bitwise right shift (unsigned)
|Bitwise inclusive OR
^Bitwise XOR (exclusive OR)
&=Bitwise AND and assign to an LValue
|=Bitwise inclusive OR and assign to an LValue
^=Bitwise exclusive XOR and assign to an LValue
<<=Bitwise shift left and assign to an LValue
>>=Bitwise shift right and assign to an LValue
>>>=Bitwise shift right (unsigned) and assign to an LValue

Warnings:

See also:Associativity, Binary bitwise operator, Bit-field, Bitwise AND (&), Bitwise AND then assign (&=), Bitwise OR then assign (|=), Bitwise shift left then assign (<<=), Bitwise shift right and assign (>>=), Bitwise unsigned shift right and assign (>>>=), Bitwise XOR and assign (^=), Logical operator, Operator, Operator Precedence, Type conversion

Cross-references:

ECMA 262 edition 2 - section - 11.10

ECMA 262 edition 3 - section - 11.10

Wrox Instant JavaScript - page - 19