---
description: https://js.edu.vn/7-ke-thua-prototype-ngang-va-doc.html
---

# class, super, constructor  (ok)

```
'use strict';
class Polygon {
	constructor(height, width) {
		this.height = height;
		this.width = width;
	}
}
class Square extends Polygon {
	constructor(sideLength) {
		super(sideLength, sideLength);
	}
	get area() {
		return this.height * this.width;
	}
	set sideLength(newLength) {
	  this.height = newLength;
	  this.width = newLength;
	}
}
var square = new Square(2);
console.log(square);
```
