We can identify the type of any data,
using typeof
.
Consider the following example:
In the example given above,
we get the output "String"
because the data - "Hello World"
is of the type String.
Let's take a look at the results
we get when we use typeof
with other data types:
In the example given above,
we get the data types
of the corresponding data
in the output.
We also can use typeof
to
find the data type of the value
stored in a variable.
In the above example,
we get the data type of
the values stored in
all the variables.
typeof name
returns undefined
because we did not
assign any value to name
.