JavaScript/Reserved words/typeof
Appearance
The typeof keyword
[edit | edit source]The typeof keyword is a unary operator that returns a string giving the type of the parametre.
Syntax
[edit | edit source] typeof[(]expression[)];
The operator returns six values, which are boolean, function, number, object, string, and undefined.
Examples
[edit | edit source] theArray = new Array();
if (typeof(theArray) == 'object') {
[…]
}