首页 > Web开发 > 详细

js判断字符串是否为空,多个空格也算为空

时间:2022-05-27 20:05:38      阅读:11      评论:0      收藏:0      [点我收藏+]
String.prototype.trim = function () {
return this.replace(/(^\s*)|(\s*$)/g, ‘‘);
}

function isEmpty(obj) {
if (typeof obj === "undefined" || obj == null || obj.trim() == "") {
return true;
} else {
return false;
}
}





js判断字符串是否为空,多个空格也算为空

原文:https://blog.51cto.com/u_15639793/5297505

(0)
(0)
   
举报
评论 一句话评论(0
分享档案
最新文章
教程昨日排行
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!