The Typeof Operator : typeof : Operators JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Operators » typeof »

 

The Typeof Operator









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:


  1. "undefined" if the variable is of the Undefined type.

  2. "boolean" if the variable is of the Boolean type.

  3. "number" if the variable is of the Number type.

  4. "string" if the variable is of the String type.

  5. "object" if the variable is of a reference type or of the Null type.





HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Operators
» typeof