const a = (obj) => {
let qObj = {}
for (let i in obj) {
qObj[i] = obj[i]
}
return qObj;
}
const b = (obj) => {
if (typeof obj === ‘object‘) {
var sObj = obj.constructor === Array ? [] : {};
for (var i in obj) {
sObj[i] = typeof (obj[i]) === ‘object‘ ? b(obj[i]) : obj[i];
}
}else {
var sObj = obj;
}
}
原文:https://www.cnblogs.com/brosky/p/14498092.html