js对象深拷贝
js对象深拷贝
// 深拷贝
export const copyObject = (orig) => {
var copy = Object.create(Object.getPrototypeOf(orig))
copyOwnPropertiesFrom(copy, orig)
return copy
}
function copyOwnPropertiesFrom(target, source) {
Object.getOwnPropertyNames(source).forEa
原创
2021-12-30 09:58:18 ·
483 阅读 ·
0 评论