class BitWiseOperators {
MyFunction()
{
var a=3,b=4;
var y = document.createElement("y");
y.style.color = "red";
var c = a & b; //BitWise And operator
y.innerText = "BitWise And operator res=" + c + "\n";
document.body.appendChild(y);
var y = document.createElement("y");
var c = a | b; //BitWise OR operator
y.innerText = "BitWise OR operator res=" + c + "\n";
document.body.appendChild(y);
var y = document.createElement("y");
y.style.color = "red";
var c = a ^ b; //BitWise XOR operator
y.innerText = "BitWise XOR operator res=" + c + "\n";
document.body.appendChild(y);
var y = document.createElement("y");
var c = a << b; //BitWise LeftShift operator
y.innerText = "BitWise LeftShift operator res=" + c + "\n";
document.body.appendChild(y);
var y = document.createElement("y");
y.style.color = "red";
var c = a >> b; //BitWise RightShift operator
y.innerText = "BitWise RightShift operator res=" + c + "\n";
document.body.appendChild(y);
var y = document.createElement("y");
var c = ~a; //BitWise Negation operator
y.innerText = "BitWise Negation operator res=" + c;
document.body.appendChild(y);
}
}
window.onload = () =>{
var call = new BitWiseOperators();
call.MyFunction();
} |