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
https://www.zhihu.com/question/34183746
The text was updated successfully, but these errors were encountered:
Object.setPrototypeOf(obj,proto) 用来将obj.__proto__设置为proto。
该方法相当于修改一个对象的内置属性[[Prototype]],是一个非常慢的操作,因为现代浏览器或JavaScript引擎都对属性访问进行过优化。修改内置属性,是一件影响范围很大的事情,并不仅仅意味着赋值obj.proto = xxx,而是可能会涉及所有用过该属性的代码,以及可能访问该属性的对象。
考虑到性能,应该尽可能避免使用该方法,而是使用Object.create方法,根据给定原型创建一个新对象。
获取一个对象的内置属性[[Prototype]]
Sorry, something went wrong.
No branches or pull requests
https://www.zhihu.com/question/34183746
The text was updated successfully, but these errors were encountered: