We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
在Class 字段一小节中,描述了一个特性:
”类字段重要的不同之处在于,它们会在每个独立对象中被设好,而不是设在 User.prototype“。
无论使用类字段、在 constructor 中使用 this 赋值、还是直接使用构造函数 +new,属性设置都是在对象中的,而非在构造函数的prototype(或对象的__proto__)。该句话存在误导性。
constructor
this
new
The text was updated successfully, but these errors were encountered:
作者想表达应该是:相对于类中的方法(它们会挂到函数的prototype上),使用带”=“的类字段,会挂到每个实例上而非对象原型上。
Sorry, something went wrong.
已更新为:类字段的重要区别在于,它们会被挂在实例对象上,而非 User.prototype 上 9f949bf
User.prototype
你看怎么样,此 issue 暂时关闭,如有后续提议,欢迎 reopen 或新建一个 issue,或者直接提 pull request
No branches or pull requests
在Class 字段一小节中,描述了一个特性:
无论使用类字段、在
constructor
中使用this
赋值、还是直接使用构造函数 +new
,属性设置都是在对象中的,而非在构造函数的prototype(或对象的__proto__)。该句话存在误导性。The text was updated successfully, but these errors were encountered: