We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
将传入的对象作为新对象原型
function myCreate(obj) { function F() {} F.prototype = obj return new F() }
var obj1 = { p: 1 }; var obj2 = Object.create(obj1); obj1.p = 2; console.log('obj', obj1, obj2,)
博客链接
The text was updated successfully, but these errors were encountered:
No branches or pull requests
博客链接
# Object.create实现
# 关键思路:
将传入的对象作为新对象原型
# 代码:
# 修改原对象的属性会影响新对象的原型:
# 点个Star支持我一下~
博客链接
The text was updated successfully, but these errors were encountered: