Ejercicio 1

This commit is contained in:
Alexis08041992
2026-06-01 20:35:16 -03:00
parent 7bd10addd8
commit 8c2458103e
2 changed files with 18 additions and 2 deletions

View File

@@ -53,6 +53,12 @@ th, td {
border-bottom: 1px solid #e0e0e0;
}
/* Centrar columnas específicas (Año y Puntaje) */
th:nth-child(3), td:nth-child(3),
th:nth-child(4), td:nth-child(4) {
text-align: center;
}
th {
background-color: #4a69bd;
color: white;

View File

@@ -7,8 +7,18 @@ let libros = [
function mostrarTabla(datos) {
// Escribir esta función para resolver el punto 1.
const libreria = document.querySelector("#listado_libros");
for (const libro of libros){
const fila = document.createElement("tr");
fila.innerHTML = `
<td>${libro.titulo}</td>
<td>${libro.autor}</td>
<td>${libro.anio}</td>
<td>${libro.puntaje}</td>
`;
libreria.appendChild(fila);
}
}
// Invocamos la función al inicio para poblar la tabla con los datos del array
mostrarTabla(libros);