JavaScript/super
来自康健生活
引言
constructor
语法糖
function Point(x, y) {
this.x = x;
this.y = y;
}
Point.prototype.toString = function () {
return `(${this.x},${this.y})`;
}
class Point {
constructor(x ,y) {
this.x = x;
this.y = y;
}
toString() {
return `(${this.x},${this.y})`;
}
}
super
No categories