InterviewSolution
Saved Bookmarks
| 1. |
Unsigned Right Shift Operator (>>>) in JavaScript? |
||||||||||||
|
Answer» The typeof operator is a unary operator in JAVASCRIPT. It is used to check the data type of its OPERAND, LIKE a variable is string, numeric, boolean, etc. Let us see a simple EXAMPLE for number: <html> <body> <script> var val = 10; document.write(typeof val); </script> </body> </html>The output displays that it is a number: NumberLet us now see ANOTHER example for string: <html> <body> <script> var val = "Sachin"; document.write(typeof val); </script> </body> </html>The output displays that it is a string: StringIn the same way, we can check the type of a value entered, which is a boolean: <html> <body> <script> var val = true; document.write(typeof val); </script> </body> </html>The output display that the value entered is a boolean: booleanAs we saw some examples above, here is the list of the values returned by the typeof operator:
|
|||||||||||||