contents   index   previous   next



typeof operator

 

The typeof operator, which also may be used as typeof(), provides a way to determine and to test the data type of a variable and may use either of the following notations, with or without parentheses.

 

var result = typeof variable

var result = typeof(variable)

 

After either line, the variable result is set to a string that is represents the variable's type: "undefined", "boolean", "string", "object", "number", or "function".

 


Flow decisions statements