Skip to content

Commit 8fa8c3b

Browse files
author
Douglas1688
committed
2 parents 2a7fffe + 7796f22 commit 8fa8c3b

4 files changed

Lines changed: 78 additions & 0 deletions

File tree

clase_11/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<script src="script.js"></script>
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
12+
</body>
13+
</html>

clase_11/script.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Persona {
2+
constructor(nombre, apellido, edad){
3+
this.nombre = nombre;
4+
this.apellido = apellido;
5+
this.edad = edad;
6+
this.datos = `Me llamo ${this.nombre} y tengo ${this.edad} años.`;
7+
}
8+
saludar(){
9+
return `Hola, me llamo ${this.nombre} y tengo ${this.edad} años.`;
10+
}
11+
12+
}
13+
14+
const p = new Persona("Juan", "Pérez",26);
15+
16+
console.log(p['saludar']());

clase_12/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<script src="script.js"></script>
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
11+
12+
</body>
13+
</html>

clase_12/script.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
class Libro{
2+
constructor(title, author, year, genre){
3+
this.title = title;
4+
this.author = author;
5+
this.year = year;
6+
this.genre = genre;
7+
}
8+
9+
infoLibro(){
10+
return `Título: ${this.title}, Author: ${this.author}, Year: ${this.year}, Genre: ${this.genre}.`;
11+
}
12+
}
13+
14+
let books = []
15+
let title, author, year, genre;
16+
while (books.length<3){
17+
18+
title = prompt('Ingrese el título: ');
19+
author = prompt('Ingrese el autor: ');
20+
year = prompt('Ingrese el año: ');
21+
genre = prompt('Ingrese el género: ').toLowerCase();
22+
23+
if(title !='' &&
24+
author!=''&&
25+
!isNaN(year)&&
26+
year.length==4 &&
27+
(genre =='aventura' || genre == 'terror' || genre == 'fantasia')){
28+
books.push(new Libro(title,author,year,genre));
29+
}
30+
31+
set
32+
33+
}
34+
// const l1 = new Libro();
35+
// const l2 = new Libro();
36+
// const l3 = new Libro();

0 commit comments

Comments
 (0)