js判断是否为空和typeof的用法(详解)

Gamila ·
更新时间:2024-09-20
· 630 次阅读

(1)typeof用法

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

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

字符串 typeof(x) = "string"

布尔值 typeof(x) = "boolean"

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

函数 typeof(x) = "function"

(2)js判断是否为空

var exp = null; if (!exp && typeof(exp)!="undefined" && exp!=0 && exp!='') { alert("is not null"); }

以上就是小编为大家带来的js判断是否为空和typeof的用法(详解)全部内容了,希望大家多多支持软件开发网~



js判断是否为空 typeof js

需要 登录 后方可回复, 如果你还没有账号请 注册新账号