The typeof operator takes one parameter: the variable or value to check.
var sTemp = "test string";
alert(typeof sTemp);
alert(typeof 95);
Calling typeof on a variable or value returns one of the following values:
- "undefined" if the variable is of the Undefined type.
- "boolean" if the variable is of the Boolean type.
- "number" if the variable is of the Number type.
- "string" if the variable is of the String type.
- "object" if the variable is of a reference type or of the Null type.