javascript 判斷對象是否為空,字符串是否為空
標簽:
JavaScript
//判断对象是否为空
//console.log(isEmptyObject()); //true
//console.log(isEmptyObject({})); //true
//console.log(isEmptyObject(null)); //true
//console.log(isEmptyObject(23)); //true
//console.log(isEmptyObject({"te": 2})); //false
function isEmptyObject(e) {
var t;
for (t in e){
return !1;
}
return !0
}
//判断字符串是否为空
function isEmptyStr(str){
if(str == null || str == 'null' || str == undefined || str == 'undefined' || str.match(/^[\s]*$/)){
return true;
}else{
return false;
}
}
點擊查看更多內容
為 TA 點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優質文章
正在加載中
感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦