-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
29 lines (27 loc) · 906 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
<head>
<title>Rectangulos</title>
<meta charset="UTF-8">
</head>
<body>
<script>
class Rectangulo {
constructor(longitud, altura, area){
this.longitud = longitud;
this.altura = altura;
this.area = area;
}
calcularArea(){
this.area = this.longitud * this.altura;
}
}
const rectangulo1 = new Rectangulo(4,5,0)
const rectangulo2 = new Rectangulo(5,8,0)
rectangulo1.calcularArea();
rectangulo2.calcularArea();
document.write('area rectangulo 1: ' + rectangulo1.area + '<br>');
document.write('area rectangulo 2: ' + rectangulo2.area + '<br>');
</script>
</body>
</html>