ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~js function deepClone(obj) { if (obj === null) return null; if (typeof obj !== 'object') return obj; if (obj instanceof Date) { let date = new Date(); date.setTime(obj.getTime()); return date; } if (obj instanceof RegExp) { let re = new RegExp(obj.source); re.lastIndex = obj.lastIndex; return re; } let newObj = new obj.constructor(); for (let key in obj) { if (obj.hasOwnProperty(key)) { newObj[key] = deepClone(obj[key]); } } return newObj; } ~~~ > 本文作者:不爱喝橙子汁