I found the following code in a JS project:
var a = new Array();
a[0] = 0;
for (var b = 0; b < 10; b++) {
a[0] |= b;
}
What does the
Returns a one in each bit position for which the corresponding bits of either or both operands are ones.
Code: result = a | b;
^ is the bitwise XOR operator, which returns a one for each position where one (not both) of the corresponding bits of its operands is a one. The next example returns 4 (0100):