<script>
let rows = [];
// Create 100 empty rows
for(let i = 0; i < 100; i++) {
rows[i] = [];
}
// Update every item in the table
function updateEverything() {
for(let row = 0; row < 100; row++) {
for(let col = 0; col < 10; col++) {
rows[row][col] = (Math.random() * 100).toPrecision(3);
}
}
}
// Update the values 100 times per second
setInterval(updateEverything, 1000 / 100);
</script>
<style>
table {
/* not sure if this matters much */
/*table-layout: fixed;*/
}
.red { color: red; }
.blue { color: blue; }
</style>
<table>
{#each rows as cells}
<tr>
{#each cells as cell}
<td class={cell < 50 ? "red" : "blue"}>{cell}</td>
{/each}