JS project 1 progress

This commit is contained in:
2026-02-05 13:58:49 -05:00
parent 62b5583957
commit 49f188ff7d
3 changed files with 58 additions and 24 deletions
@@ -1,22 +1,4 @@
fetch('./js/Meteorite_Landings.json')
.then((response) => response.json())
.then(data => {
console.log(data);
const tableBody = document.getElementById("meteorTableBody");
data.splice(0,50).forEach(meteor => { // Just get 50 values for now
const row = document.createElement("tr");
const id = document.createElement("td");
id.textContent = meteor.id ?? "-";
const name = document.createElement("td");
name.textContent = meteor.name ?? "-";
const year = document.createElement("td");
year.textContent = meteor.year ?? "-";
const recclass = document.createElement("td");
recclass.textContent = meteor.recclass ?? "-";
const mass = document.createElement("td");
mass.textContent = meteor["mass (g)"] + "g" ?? "-";
row.append(id, name, year, recclass, mass);
tableBody.appendChild(row);
})
})
.catch(error => console.error(error));
// TODO:
// Implement Search by year and name
// Reset filters button
// Clickable table headers for sortin (reuse code?)