dan*_*ler 5 javascript ecmascript-6
我正在研究新的Javascript ES6类,但我不明白为什么这些类定义不像对象文字中那样使用逗号。
来自MDN的示例:
class Polygon {
constructor(height, width) {
this.height = height;
this.width = width;
}
get area() {
return this.calcArea();
}
calcArea() {
return this.height * this.width;
}
}
Run Code Online (Sandbox Code Playgroud)
这不是一个真正的问题,但是我觉得我缺少一些东西。感谢您的指示!