I\'m trying to implement XOR in javascript in the following way:
// XOR validation if ((isEmptyString(firstStr) && !isEmptyString(secondStr)) |
There's a few methods, but the ternary method (a ? !b : b) appears to perform best. Also, setting Boolean.prototype.xor appears to be an option if you need to xor things often.
http://jsperf.com/xor-implementations