How to define a XOR in the JS, in the case of this question it is necessary to return as if it were a truth table of the "XOR"

Asked

Viewed 13 times

0

function xor(true,false){
  return (true && false) && (false &&true) !(true && true) && (false && false);
}
  • Aline, the XOR returns true only if the entries are different... Then a != b is equivalent to a xor b for boolean values...

  • I managed to solve, thanks Fernando! solution: Function xor(a,b){ Return a != b; }

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.