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
下面这段代码及注释思考了很久还是不太明白,这里判断this.constructor === SubClass 具体的用途是什么。 什么情况下 this.constructor !== SubClass? this.constructor === SubClass 又意味着什么? 请大神赐教 // Only call initialize in self constructor. if (this.constructor === SubClass && this.initialize) { this.initialize.apply(this, arguments) }
The text was updated successfully, but these errors were encountered:
function Parent(){} function Child(){} Child.prototype = new Parent(); console.log(new Child().constructor); // function Parent(){}
这意味着prototype的不谨慎赋值将影响constructor的查找。
Sorry, something went wrong.
No branches or pull requests
下面这段代码及注释思考了很久还是不太明白,这里判断this.constructor === SubClass 具体的用途是什么。 什么情况下 this.constructor !== SubClass? this.constructor === SubClass 又意味着什么? 请大神赐教
// Only call initialize in self constructor.
if (this.constructor === SubClass && this.initialize) {
this.initialize.apply(this, arguments)
}
The text was updated successfully, but these errors were encountered: