Use Bitwise Exclusive OR Operator in JavaScript
Description
The following code shows how to use Bitwise Exclusive OR Operator.
Example
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
//25 = 0000 0000 0000 0000 0000 0000 0001 1001
// 3 = 0000 0000 0000 0000 0000 0000 0000 0011
//--------------------------------------------
//OR = 0000 0000 0000 0000 0000 0000 0001 1011
<!--from w w w . j ava2 s.com-->
var iResult = 25 | 3;
document.writeln(iResult); //outputs "27"
</script>
</body>
</html>
The code above generates the following result.
Javascript Tutorial Bitwise
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...
Use Bitwise Exclusive OR Operator in JavaSc...
Use Bitwise NOT (~) Operator in JavaScriptUse 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...