UNPKG

quxapp

Version:

Qux App is a lightweight module that contains many functions for array operations, sequences, and statistics. Qux App makes writing JavaScript easier and quicker every day!

14 lines (13 loc) 562 B
function xor(first, second) { if (typeof first === 'string' && typeof second === 'string') { const one = first.split('') const two = second.split('') const list = one.filter(x => !two.includes(x)).concat(two.filter(x => !one.includes(x))) return list.join('') } else if (typeof first === 'number' && typeof second === 'number') { return first ^ second } else if (Array.isArray(first) && Array.isArray(second)) { return first.filter(x => !second.includes(x)).concat(second.filter(x => !first.includes(x))) } } module.exports = xor