xor operator js
const a = 5; // 00000000000000000000000000000101 const b = 3; // 00000000000000000000000000000011 // xor operator ^ console.log(a ^ b); // 00000000000000000000000000000110 // expected output: 6
Here is what the above code is Doing:
1. a is 5, which is 00000000000000000000000000000101 in binary.
2. b is 3, which is 00000000000000000000000000000011 in binary.
3. a ^ b is 6, which is 00000000000000000000000000000110 in binary.