What is JavaScript Bitwise AND (&) Operator?

HTMLJavascriptProgramming Scripts

If both the bits are 1, then 1 is returned when Bitwise AND (&) operator is used.

Example

You can try to run the following code to learn how to work with JavaScript Bitwise AND Operator −

<!DOCTYPE html>
<html>
   <body>
      <script>
         document.write("Bitwise AND Operator<br>");

         // 7 = 00000000000000000000000000000111
         // 1 = 00000000000000000000000000000001
         document.write(7 & 1);
      </script>
   </body>
</html>
raja
Published on 26-Feb-2018 14:32:07
Advertisements