Last active
March 8, 2017 18:39
-
-
Save theharveyz/2f206e186a6aaac2ea08405911cc1961 to your computer and use it in GitHub Desktop.
clone一个对象
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const clone = (origin) => { | |
//Object.create 创建一个指定原型的对象,可选若干参数 | |
return Object.assgin(Object.create(Object.getPrototypeOf(origin)), origin); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
不是深拷贝