美文网首页
js递归处理null情况

js递归处理null情况

作者: 落叶知声 | 来源:发表于2017-03-06 13:37 被阅读0次

setNullToEmpty: function (obj) {
var _this = this;
$.each(obj, function (index, data) {
if (Object.prototype.toString.call(data) == '[object Object]' || Object.prototype.toString.call(data) == '[object Array]') {
_this.setNullToEmpty(data);
} else {
if (obj[index] === 'null' || obj[index] === null) {
obj[index] = '';
}
}
});
},

相关文章

网友评论

      本文标题:js递归处理null情况

      本文链接:https://www.haomeiwen.com/subject/vfxugttx.html