js判空

2014年9月3日 11:36:10

转载的: http://blog.sina.com.cn/s/blog_755168af0100vsik.html

typeof用法

typeof的运算数未定义,返回的就是 "undefined".

运算数为数字 typeof(x) = "number"

字符串 typeof(x) = "string"

布尔值 typeof(x) = "boolean"

函数 typeof(x) = "function"

对象,数组 和null typeof(x) = "object" //重要

 

posted @ 2014-09-03 11:38  myD  阅读(258)  评论(0编辑  收藏  举报