Ejercicio 1
This commit is contained in:
@@ -53,6 +53,12 @@ th, td {
|
|||||||
border-bottom: 1px solid #e0e0e0;
|
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 {
|
th {
|
||||||
background-color: #4a69bd;
|
background-color: #4a69bd;
|
||||||
color: white;
|
color: white;
|
||||||
|
|||||||
14
script.js
14
script.js
@@ -7,8 +7,18 @@ let libros = [
|
|||||||
|
|
||||||
function mostrarTabla(datos) {
|
function mostrarTabla(datos) {
|
||||||
// Escribir esta función para resolver el punto 1.
|
// 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
|
// Invocamos la función al inicio para poblar la tabla con los datos del array
|
||||||
mostrarTabla(libros);
|
mostrarTabla(libros);
|
||||||
|
|||||||
Reference in New Issue
Block a user