Operators

Bitwise xor (^)

Try the free JavaScript compiler

Sets bits where exactly one operand has a set bit. Useful for toggling masks. Number operands use signed 32-bit representations.

Formal Syntax & Structure

javascript syntaxjavascript
left ^ right

Parameters & Attributes

NameTypeDescription
leftexpressionLeft operand.
rightexpressionRight operand; short-circuiting may skip evaluation where applicable.

Return Value

Number or BigInt

Result of the operation.

Working Example

Example Snippetjavascript
console.log(7 ^ 2);
JavaScript Reference