JavaScript typeof Operator Example

Updated on     Kisan Patel

To find the data type of its operand, such as whether a variable is string, numeric, or even undefined in javascript, you need to use typeof operator.

Syntax

typeof operand
  1. The typeof operator returns the primitive type of the variable.
  2. If the variable is of object type or null then it returns objects.
  3. If a variable is declared and is not used then its type is undefined.


JavaScript

Leave a Reply