Using the Bitwise AND Plus Assignment Operator : Bitwise Operator : Operators JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Operators » Bitwise Operator »

 

Using the Bitwise AND Plus Assignment Operator














var iResult = 25 3;
alert(iResult);    //outputs "1"

 25 0000 0000 0000 0000 0000 0000 0001 1001
  0000 0000 0000 0000 0000 0000 0000 0011
---------------------------------------------
AND = 0000 0000 0000 0000 0000 0000 0000 0001














<html>
    <script language="JavaScript">
    <!--
    // integer = 32-bit binary representation
    // 12 = 00000000000000000000000000001100
    //  6 = 00000000000000000000000000000110
    //  4 = 00000000000000000000000000000100
    x = 6;
    x &= 12;
    document.write("x = ",x);
    -->
    </script>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Operators
» Bitwise Operator