Using the Bitwise Exclusive OR Operator : Bitwise Operator : Operators JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Operators » Bitwise Operator »

 

Using the Bitwise Exclusive OR Operator














var iResult = 25 3;
alert(iResult);    //outputs "26"
25 0000 0000 0000 0000 0000 0000 0001 1001
  0000 0000 0000 0000 0000 0000 0000 0011
---------------------------------------------
XOR = 0000 0000 0000 0000 0000 0000 0001 1010














<html>
    <script language="JavaScript">
    <!--
    // integer = 32-bit binary representation
    // 6 = 00000000000000000000000000000110
    // 3 = 00000000000000000000000000000011
    // 5 = 00000000000000000000000000000101
    document.write("6 ^ 3 = "(3) );
    -->

    </script>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Operators
» Bitwise Operator