判断字符串是否为空

原文出处: https://www.cnblogs.com/shuilangyizu/p/7744111.html

 

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

 

使用示例:

if (!isEmpty(value)) {
    alert(value);
}
posted @ 2020-01-13 16:40  fpc  阅读(469)  评论(0编辑  收藏  举报