2 | 3 //Output is 3
7 | 9 //Output is 15
I tried 2 | 3
in the console and I got an output of 3
. When I did 7 | 9
, the output is 15
. How does it work?
2 | 3 //Output is 3
7 | 9 //Output is 15
I tried 2 | 3
in the console and I got an output of 3
. When I did 7 | 9
, the output is 15
. How does it work?
It is the OR
operator used for Bitwise Operations.
Example :
5 | 1
It will be the same as 0101 | 0001
Result: 0101 = 5