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: 

Number

Let 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:

String

In 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:

boolean

As we saw some examples above, here is the list of the values returned by the typeof operator:

Type
String Returned
Number type
Returns “number”
String type
Returns “string”
Object type
Returns “object”
Boolean type
Returns “boolean”
Null
Returns “null”


Discussion

No Comment Found