21类的基本语法,类和构造
keduhoutian opened this issue · comments
keduhoutian commented
原文:
class Point { constructor() { // ... } toString() { // ... } }
// 等同于
Point.prototype = { constructor() {}, toString() {} }
这里感觉不能完全这么说?一般构造函数是下面这样吗?
Point.prototype = { constructor:Point, toString() {} }
即Point.prototype.constructor === Point
Ruan YiFeng commented
这里只是说明,类的定义等价于原型,不是给出精确的实现。