function deepClone(obj) { if(obj == null) return obj; // null == undefined if(obj instanceof Date) return new Date(obj); if(obj instanceof RegExp) return new RegExp(obj); if(typeof obj != 'object') return obj; let newObj = new obj.constructor; for(let key in obj) { newObj[key] = deepClone(obj[key]); } return newObj; }
①JSON.stringify复制对象特色
②一步步推导出的深拷贝
③jquery中extend拷贝方法
④Object.create拷贝方法html