JS判定空值null以及未定义值undefined

来源:互联网 发布:数据库范式 编辑:程序博客网 时间:2024/06/06 02:32

判定空值

var exp = null; if (!exp)       {            alert("is null");        }

 判定未定义

var exp = undefined;  if (typeof(exp) == "undefined"){    alert("undefined");}

 

0 0
原创粉丝点击