js中(!exp)
来源:互联网 发布:赛为智能人工智能 编辑:程序博客网 时间:2024/06/07 22:36
var exp = null;
if (!exp && typeof exp != "undefined" && exp != 0)
{
alert("is null");
}
typeof exp != "undefined" 排除了 undefined;
exp != 0 排除了数字零和 false。
更简单的正确的方法:
var exp = null;
if (exp === null)
{
alert("is null");
}
--------------------------------------------------------------------------------
尽管如此,我们在 DOM 应用中,一般只需要用 (!exp) 来判断就可以了,因为 DOM 应用中,可能返回 null,可能返回 undefined,如果具体判断 null 还是 undefined 会使程序过于复杂。
if (!exp && typeof exp != "undefined" && exp != 0)
{
alert("is null");
}
typeof exp != "undefined" 排除了 undefined;
exp != 0 排除了数字零和 false。
更简单的正确的方法:
var exp = null;
if (exp === null)
{
alert("is null");
}
--------------------------------------------------------------------------------
尽管如此,我们在 DOM 应用中,一般只需要用 (!exp) 来判断就可以了,因为 DOM 应用中,可能返回 null,可能返回 undefined,如果具体判断 null 还是 undefined 会使程序过于复杂。
0 0
- js中(!exp)
- ORACLE 中EXP命令
- oracle中exp使用
- exlipse js中excelService.exp,excelService.imp里的属性都是什么
- exp中query的使用方法
- oracle中exp/emp使用
- oracle 中exp备份优化
- oracle中exp/imp讲解
- oracle中exp/imp讲解
- EXP
- exp
- EXP
- exp
- exp
- exp
- exp
- EXP
- Oracle中Exp和Imp命令详解
- 二叉树基本操作(二) -----显示
- 关于google的gson-2.3.1.jar,发现一个奇怪的bug
- 文章标题
- Hibernate自动建表编码问题
- 2015-11-12 android对变量监听(一)使用子线程定时监察
- js中(!exp)
- UITableViewStyle设置Group、Plain问题
- 最近学习太慢
- xcode7 update
- 浅谈软件工程学习心得
- weiphp——关于留言板插件的创建和使用
- c++中临时变量不能作为非const的引用参数
- react native环境搭建
- $HTTP_RAW_POST_DATA 与$_POST