Use Compound Bitwise OR Assignment |= in JavaScript
Description
The following code shows how to use Compound Bitwise OR Assignment |=.
Example
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
<!--from w ww . j a va 2s .c om-->
// 2 = 00000000000000000000000000000011
// 5 = 00000000000000000000000000000101
// 7 = 00000000000000000000000000000111
var x = 2;
x |= 5;
document.write("x = ",x);
</script>
</body>
</html>
The code above generates the following result.
Javascript Tutorial Bitwise
Use Bitwise Exclusive OR Operator in JavaSc...
Use Bitwise NOT (~) Operator in JavaScript
Use Shift Right Zero Fill Assignment Operat...
Use Shift Right Zero Fill Operator in JavaS...
Use Shift Right with Sign Assignment Operat...
Use Shift Right with Sign operator in JavaS...
Use the Bitwise AND Operator in JavaScript
Use the Bitwise AND Plus Assignment Operato...
Use the Bitwise Exclusive OR Operator in Ja...
Use the Compound Bitwise AND Operator in Ja...
Use the shift left operator in JavaScript
Using Bitwise Exclusive OR Assignment Opera...
Use Bitwise Exclusive OR Operator in JavaSc...
Use Bitwise NOT (~) Operator in JavaScript
Use Compound Bitwise OR Assignment |= in Ja...
Use Shift Left Assignment operator in JavaS...Use Shift Right Zero Fill Assignment Operat...
Use Shift Right Zero Fill Operator in JavaS...
Use Shift Right with Sign Assignment Operat...
Use Shift Right with Sign operator in JavaS...
Use the Bitwise AND Operator in JavaScript
Use the Bitwise AND Plus Assignment Operato...
Use the Bitwise Exclusive OR Operator in Ja...
Use the Compound Bitwise AND Operator in Ja...
Use the shift left operator in JavaScript
Using Bitwise Exclusive OR Assignment Opera...