xor()

Performs a bitwise XOR (exclusive OR) operation on one or more integers.

Syntax

xor(value1, [value2, ...])

Parameters

Parameter Type Description
value1 Number The first integer value.
value2..N Number Additional integer values to apply XOR with. optional

Return Value

Examples

Single value, returns itself

xor(5);      // returns 5

Bitwise XOR of 5 (0101) and 3 (0011) → 0110

xor(5, 3);   // returns 6

Bitwise XOR of 1 (0001), 2 (0010), and 3 (0011)

xor(1, 2, 3); // returns 0

See also

bit
not
and
or
xor
nand
nor
xnor
shl
shr