get
इस ES6 वर्ग में क्या अर्थ है? मैं इस फ़ंक्शन का संदर्भ कैसे दूं? मुझे इसका उपयोग कैसे करना चाहिए?
class Polygon {
constructor(height, width) {
this.height = height;
this.width = width;
}
get area() {
return this.calcArea()
}
calcArea() {
return this.height * this.width;
}
}
class
वाक्य रचना है, लेकिन गेटर्स कोई नई बात नहीं है।