Bitwise operators convert each operand to 32-bit integers before being applied. The operators are as follows:
| Operator | Usage | Description |
|---|---|---|
| Bitwise AND | a & b |
Returns a one in each bit position for which the corresponding bits of both operands are ones. |
| Bitwise OR | `a | b` |
| Bitwise XOR | a ^ b |
Returns a zero in each bit position for which the |
| corresponding bits are the same. [Returns a one in each bit position for | ||
| which the corresponding bits are different.] | ||
| Bitwise NOT | ~ a |
Inverts the bits of its operand. |
| Left shift | a << b |
Shifts a in binary representation b bits to the left, shifting in zeros from the right. |
| Sign-propagating right shift | a >> b |
Shifts a in binary representation b bits to the right, discarding bits shifted off. |
| Zero-fill right shift | a >>> b |
Shifts a in binary representation b bits to the right, discarding bits shifted off, and shifting in zeros from the left. |
BigInt operators are almost exactly the same as Number operators, except for the unsigned right shift operator (>>>), since BigInts don’t have a fixed width.
It’s also not possible to mix BigInts with Numbers in operations, you must explicitly convert one of them before performing any operations
delete, void, typeof, +, -, ~, !, await