JavaScript Programmer’s Reference Bitwise XOR (^) (Apache web server for windows) (Operator/bitwise) Bitwise
JavaScript Programmer’s Reference Bitwise XOR (^) (Operator/bitwise) Bitwise XOR one operand with another. Availability: ECMAScript edition 2 JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Netscape Enterprise Server 2.0 Opera 3.0 Property/method value type: Number primitive JavaScript syntax: -anOperand1 ^ anOperand2 anOperand1 A numeric value Argument list: anOperand2 Another numeric value Performs a bit-by-bit XOR of the 32-bit values derived from both operands. Where a corresponding bit is different in both operands, a 1 bit will be inserted into the result. If the corresponding bit is identical in both operands, regardless of whether they both have a 1 bit or a zero bit, a zero will be inserted at that bit position in the result. The associativity is left to right. Refer to the Operator Precedence topic for details of execution order. This is the truth table for two Boolean primitive values being operated on with the XOR operator. A B XOR false false false false true true true false true true true false The bitwise operator performs this operation on each corresponding bit pair in the two operands. 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1