Skip to content

如何理解判断this.constructor === SubClass? #17

Open
@Tonyhark

Description

@Tonyhark

下面这段代码及注释思考了很久还是不太明白,这里判断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)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions