Proyectos (DIA 1 - 13)

Realizados gracias al curso "JAVASCRIPT TOTAL"
This commit is contained in:
Cris
2026-01-30 19:16:11 -05:00
committed by GitHub
commit 03a7ef3253
67 changed files with 2204 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Veterinaria</title>
<link rel="stylesheet" href="styles.css">
<script src="script.js"></script>
</head>
<body>
<h1>Veterinaria Animalito´s</h1>
<div class="textoCentrado">
<button onclick="mostrarAnimales()">Mostrar Animales</button>
</div>
<ul id="listaAnimales"></ul>
</body>
</html>
+62
View File
@@ -0,0 +1,62 @@
class Animal {
constructor(nombre, peso, edad) {
this.nombre = nombre;
this.peso = peso;
this.edad = edad;
}
informacion() {
return `${this.nombre} - ${this.peso} kg. - ${this.edad} años.`
}
}
class Perro extends Animal {
constructor(nombre, peso, edad, raza) {
super(nombre, edad, peso);
this.raza = raza;
}
informacion() {
return `${this.nombre} - ${this.peso} kg. - ${this.edad} años. - ${this.raza}`
}
}
class Gato extends Animal {
constructor(nombre, peso, edad, sexo) {
super(nombre, edad, peso);
this.sexo = sexo;
}
informacion() {
return `${this.nombre} - ${this.peso} kg. - ${this.edad} años. - ${this.sexo}`
}
}
class Conejo extends Animal {
constructor(nombre, peso, edad, color) {
super(nombre, edad, peso);
this.color = color;
}
informacion() {
return `${this.nombre} - ${this.peso} kg. - ${this.edad} años. - ${this.color}`
}
}
let perro1 = new Perro('Simba', 11, 4, 'Shih Tzu');
let gato1 = new Gato('Ringo', 4, 6, 'Macho');
let conejo1 = new Conejo('Dumbo', 2, 3,'Blanco');
let animales = [perro1, gato1, conejo1];
function mostrarAnimales() {
let lista = document.getElementById('listaAnimales');
lista.innerHTML = '';
for(let animal of animales) {
let item = document.createElement('li');
item.innerText = animal.informacion();
lista.appendChild(item);
}
}
+38
View File
@@ -0,0 +1,38 @@
h1 {
font-family: 'Courier New', Courier, monospace;
color: brown;
text-shadow: 2px 2px 4px #ff1c1c;
font-size: 40px;
text-align: center;
}
button {
background-color: #7b3015;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 5px;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
li {
background-color: #f1f1f1;
padding: 10px;
border-bottom: 1px solid #ccc;
text-align: center;
}
.textoCentrado {
text-align: center;
}