What is Bitwise XOR Assignment Operator (^=) in JavaScript?

It performs XOR operation on the right operand with the left operand and assigns the result to the left operand.

Example

You can try to run the following code to learn how to work with Bitwise XOR Assignment Operator

<html>
  <body>
   <script>
     var a = 2;  // Bit presentation 10
     var b = 3;  // Bit presentation 11
     document.write("(a ^= b) => ");
     document.write(a ^= b);
   </script>
  </body>
</html>
Updated on: 2020-01-08T07:51:50+05:30

351 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements