August 1999
Intermediate to advanced
1488 pages
72h 53m
English
typeof(variable)
The typeof unary operator is used to determine the type of the variable passed to it. The return values of this operator are boolean, number, object, string, or undefined.
Note
Because undefined was not fully implemented until JavaScript 1.3 and JScript 3.0, many supporting browsers return null when passing a variable that has not been defined.
Listing 6.267 creates boolean, number, object, string, and undefined variable instances, and then uses the typeof operator to write their type to the page.
<html> <head> <title>Listing ... |
Read now
Unlock full access