yibusky 发表于 2013-1-29 08:43:54

js学习之typeof

alert(typeof("aa"));                                string
alert(typeof(123));                                 number
alert(typeof(true));                                boolean
alert(typeof(new Array()));                    object
alert(typeof(function(){}));                    function
alert(typeof(dd));---dd未定义                  undefind
 
typeof 运算符返回一个用来表示表达式的数据类型的字符串。 
可能的字符串有:"number"、"string"、"boolean"、"object"、"function" 和 "undefined"。 
页: [1]
查看完整版本: js学习之typeof