Page 344 - Webapplication11_C11_Flipbook
P. 344
var a = 9, b = 65;
document.write("Bitwise AND operator a & b = " + (a&b));
document.write("<br> Bitwise OR operator a | b = " + (a|b));
document.write("<br> Bitwise EXCLUSIVE OR operator a^b = " + (a^b));
document.write("<br> Bitwise NOT operator ~a = " + (~a));
document.write("<br> LEFT SHIFT operator a << 1 = " + (a << 1));
document.write("<br> RIGHT SHIFT operator b >> 1 = " + (b >> 1));
</SCRIPT>
</BODY>
</HTML>
Output of the above code is as follows:
The typeof Operator
The typeof operator is a type checking operator in JavaScript that returns the data type of the operand passed to it. The
argument for the typeof operator can be any variable, function, or object whose type you want to determine.
Let us create a JavaScript program to use the typeof operator.
<HTML>
<BODY>
<SCRIPT>
document.write(typeof 'PIZZA'+"<br>")
document.write(typeof 50 +"<br>")
document.write(typeof true)
</SCRIPT>
</BODY>
</html>
Output of the above code is as follows:
342 Touchpad Web Applications-XI

