Operators

Bitwise xor assignment (^=)

Try the free JavaScript compiler

Toggles target bits where the right operand has set bits, then stores the result. Both operands are evaluated; this is not a Boolean-only operation.

Formal Syntax & Structure

javascript syntaxjavascript
target ^= value

Parameters & Attributes

NameTypeDescription
targetassignment targetWritable binding or property; evaluated once.
valueexpressionRight operand used by the underlying operation.

Return Value

operation result

The value written to the target.

Working Example

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