The
typeof operator is an in-built Javascript operator and is used to identify the type of an object.
It always returns a String value,so we should always compare return value to a string.
typeof is an operand and not a function.
There are 2 ways to call the method.
Consider following Example:-
typeof 10;
Output :- number
typeof true;
Output :- boolean
typeof undefined;
Output :- undefined
typeof {};
Output :- object
Calling typeof operand with parenthesestypeof(20);
Output :- number
As typeof is an operand and not a function,that is the reason,the second method is actually not a function call.
Operation in parentheses are evaluated and then passed to typeof.