What does ^ mean? Whar does it do? What happen when i use it?
I got 10 in the console, i don’t get how did i got that result.
let okay = 25 ^ 19;
console.log(okay);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15
.The caret character is used in Regular Expressions to create a set of charcters that you do not want to match, negated character setsThis text will be blurred
2 Likes
OP has posted a binary exclusive or operation (XOR).
25 ^ 19 turns both into their binary code and combines the pair to the binary equivalent of “10” .
Let me see if I still get the table of truth together:
A B A XOR B
0 0 0
0 1 1
1 0 1
0 0 0
XOR are often used for encryption algorithms, are really messy and I’m glad I don’t have to deal with them directly.
Teller
December 18, 2023, 10:30am
4
Here’s an MDN article about XOR
system
Closed
June 17, 2024, 10:31pm
5
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.