×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: userc865b
Added: Oct 24, 2018 1:30 PM
Views: 3492
Tags: js
  1. //https://stackoverflow.com/questions/4540422/why-is-there-no-logical-xor-in-javascript
  2.  
  3. var state1 = false,
  4.     state2 = true;
  5.    
  6. var A = state1 ^ state2;     // will become 1
  7. var B = !!(state1 ^ state2); // will become true
  8. console.log(A);
  9. console.log(B);