1. 程式人生 > >js判斷字符是否為空的方法

js判斷字符是否為空的方法

return ise 字符 empty 是否 als cti ret undefine

js判斷字符是否為空的方法:

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

使用示例:

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

js判斷字符是否為空的方法