^ javascript operator

Hi there,
I’m doing codewars tasks. I’m wondering what the ^ is doing.
This is an example:
const stray = nums => nums.reduce((a, b) => a ^ b);
I know what is doing reduce, but I’m not sure about a ^ b.

Thank you in advance.

That’s doing a bitwise XOR operation.

1 Like

Thank you a lot :).

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.