•Used to fetch the data type of its operand.
•Return type is string.
Syntax:
typeof operand
or
typeof(operand)
•Parentheses can be used for determining the data type of expressions.
Possible Return Types
•Undefined
•Null
•Boolean
•Number
•BigInt
•String
•Symbol
•Function
•Object
Points to Remember
•The data type of NaN is number.
•The data type of an array is object.
• The data type of a date is object.
• The data type of null is object.
• The data type of an undefined variable is undefined.
•The data type of a variable that has not been assigned a value is also undefined.
Please check below video for more detailed explaination on typeof Operator in JavaScript with the help of examples:
Let me know your questions and doubts in comment section of the video.
Categories: Javascript