Javascript

typeof Operator in JavaScript

•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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s