js判断是否为空和typeof的用法(详解)
(1)typeof用法
typeof的运算数未定义,返回的就是"undefined".
运算数为数字typeof(x)="number"
字符串typeof(x)="string"
布尔值typeof(x)="boolean"
对象,数组和nulltypeof(x)="object"
函数typeof(x)="function"
(2)js判断是否为空
varexp=null; if(!exp&&typeof(exp)!="undefined"&&exp!=0&&exp!='') { alert("isnotnull"); }
以上就是小编为大家带来的js判断是否为空和typeof的用法(详解)全部内容了,希望大家多多支持毛票票~