首页 > 技术文章 > JavaScript--判断字符是否为空

dcy521 2019-08-21 08:48 原文

js代码:

//判断字符是否为空的方法
function IsEmpty(res){
    if(typeof res== "undefined" || res== null || res== ""){
        return true;
    }else{
        return false;
    }
}

js调用:

if (!IsEmpty(value)) {
    alert(value);
}

 

推荐阅读