Why is there no logical xor in JavaScript?

前端 未结 19 2110
忘了有多久
忘了有多久 2020-11-29 17:17

Why is there no logical xor in JavaScript?

19条回答
  •  清酒与你
    2020-11-29 17:38

    The XOR of two booleans is simply whether they are different, therefore:

    Boolean(a) !== Boolean(b)
    

提交回复
热议问题