I\'m trying to implement XOR in javascript in the following way:
// XOR validation if ((isEmptyString(firstStr) && !isEmptyString(secondStr)) |
Assuming you are looking for the BOOLEAN XOR, here is a simple implementation.
function xor(expr1, expr2){ return ((expr1 || expr2) && !(expr1 && expr2)); }
The above derives from the definition of an "exclusive disjunction" {either one, but not both}.