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" //重要

原文地址:https://www.cnblogs.com/iLoveMyD/p/3953309.html