我是靠谱客的博主 老迟到棉花糖,这篇文章主要介绍js判断字段是否为空 isNulljs判断字段是否为空 isNull,现在分享给大家,希望可以做个参考。

js判断字段是否为空 isNull

 

//在js中if条件为null/undefined/0/NaN/""表达式时,统统被解释为false,此外均为true .
//为空判断函数
function isNull(arg1)
{
 return !arg1 && arg1!==0 && typeof arg1!=="boolean"?true:false;
}


//alert(isNull(null));    //true
//alert(isNull(''));      //true
//alert(isNull());       //true
//var aa={};          
//alert(isNull(aa.a));   //true
//alert(isNull(0));        //false
//alert(isNull('0'));    //false
//alert(isNull(true));   //false
//alert(isNull("undefined"));  //false
//alert(isNull(undefined));     //true
//alert(isNull([]));       //false
//alert(isNull({}));       //false

 

来自:http://blog.sina.com.cn/s/blog_68ead6830101cx3u.html

转载于:https://www.cnblogs.com/hsmWorld/p/10088004.html

最后

以上就是老迟到棉花糖最近收集整理的关于js判断字段是否为空 isNulljs判断字段是否为空 isNull的全部内容,更多相关js判断字段是否为空内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(58)

评论列表共有 0 条评论

立即
投稿
返回
顶部