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
class Point { constructor(x, y) { this.x = x; this.y = y; } add() { return this.x + this.y; } }
const b = new Point(1, 3); console.log(b) console.log(b.__proto__) console.log(b.constructor) console.log(Point.prototype) console.log(Point.prototype.constructor) console.log('实例对象的原型指向类的prototype属性'); console.log('b.__proto__ === Point.prototype'); console.log(b.__proto__ === Point.prototype); console.log('类的原型属性prototype属性的构造函数指向类本身===类本身就指向构造函数'); console.log('Point.prototype.constructor === Point'); console.log(Point.prototype.constructor === Point); console.log('实例对象的构造函数指向类'); console.log('b.constructor === Point'); console.log(b.constructor === Point); console.log('实例对象的constructor方法指向类原型的构造方法'); console.log('b.constructor === Point.prototype.constructor'); console.log(b.constructor === Point.prototype.constructor)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: