Javascript Reference
Categories: Operators

javascript Operators |

@March 15, 2008, 1:22 a.m.
| Firefox/Netscape/NN 2 IE 3 ECMA 1  

  

The bitwise OR operator performs binary math on two operands (their binary values). Each column of bits is subjected to the Boolean OR operation. If the value of a column in both operands is 0, the result for that column position is 0. All other combinations yield a 1. The resulting value of the operator is the decimal equivalent of the binary result. For example, the binary values of 3 and 6 are 0011 and 0110, respectively. After an OR operation on these two values, the binary result is 0111; the decimal equivalent is 7.

 
Example
 
var n = 3 | 6;

Powered by Linode.