1 判断字符串为空
(1)第一种方法
var test="";
if(test==""||test==null||test==undefined){
alert("为空");
}
(2)第二种方法
var test="";
if(!test){
alert("为空");
}
2 判断字符串不为空
(1)第一种方法
var test="";
if(test!=""&&test!=null&&test!=undefined){
alert("不为空");
}
(2)第二种方法
var test="";
if(!!test){
alert("不为空");
}

最低0.47元/天 解锁文章
6758

被折叠的 条评论
为什么被折叠?



