JavaScript Bitwise Operator With Example

JavaScript Operators Definition

An operator that performs some operation on single or multiple operands and produces a result is called Operators.

An Operators are symbols or keyword that enable JavaScript to perform some sort of actions.


JS Bitwise Operator:

JavaScript bitwise operators evaluate and perform specific bitwise (32 bits either zero or one) expression.

Operator Sign Description
Bitwise AND & Return bitwise AND operation for given two operands.
Bitwise OR | Return bitwise OR operation for given two operands.
Bitwise XOR ^ Return bitwise XOR operation for given two operands.
Bitwise NOT ~ Return bitwise NOT operation for given operand.
Bitwise Shift Left << Return left shift of given operands.
Bitwise Shift Right >> Return right shift of given operands.
Bitwise Unsigned Shift Right >>> Return right shift without consider sign of given operands.

Example:

Result:

Bitwise AND :0
Bitwise OR :15
Bitwise XOR :15
Bitwise NOT :-6
Bitwise Shift Left :40
Bitwise Shift Right :2
Unsigned Shift Right :2


Read Also: