InterviewSolution
Saved Bookmarks
| 1. |
What is the new way to define a variable in JavaScript? |
|
Answer» In the unsigned right SHIFT operator (>>>), the bits shifted on the left are always zero. The zeros get filled in from the left with the operator. It shifts all bits in a 32-bit number to the right. The following is an example: <html> <BODY> <script> var val1 = -23; var val2 = 2; document.write("val1 >>> val2 = "); res = (val1 >>> val2); document.write(res); </script> </body> </html>The OUTPUT: val1 >>> val2 = 1073741818Let us see another example wherein we have a positive number. In this CASE the operator works the same as a signed right shift: <html> <body> <script> var val1 = 7; var val2 = 2; document.write("val1 >>> val2 = "); res = (val1 >>> val2); document.write(res); </script> </body> </html>The output: val1 >>> val2 = 1 |
|