<!--
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
-->
<html>
<body>
<h1>Hello World</h1>
<p></p>
<script src="index.js"></script>
</body>
</html>
class Rectangle {
constructor(height, width) {
this.height = height;
this.width = width;
}
// Getter
get area() {
return this.calcArea(); // إستدعاء التابع calcArea
}
// Method
calcArea() {
return this.height * this.width;
}
}
const rec = new Rectangle(5, 10);
document.querySelector('p').innerText = rec.area; // وضع مساحة المستطيل في الفقرة