js递归处理null情况

2017-03-06  本文已影响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] = '';
}
}
});
},

上一篇 下一篇

猜你喜欢

热点阅读