Problem statement
A reusable function that fills a report table from a list of records using Vanilla TypeScript and standard DOM APIs. The page provides an existing table with an empty body — the function builds the rows and puts them in place, rather than assembling the table out of HTML text.
Demo
The page, styles, table markup, and report data are already scaffolded and wired. Only the renderTableRows function is missing — implement it in src/js/tableRowBuilder.ts so every test passes. Do not edit any other file.
What to implement
- Take a table body and a list of records, and fill that table body with them.
- Produce one row per record, keeping the order the records arrived in.
- Give every row one cell per column, always in the same column order.
- Show each value word for word. If a value looks like markup, show it as plain words instead of letting it become part of the page.
- Mark the money cell so it can be styled apart from the others, and leave every other cell unmarked.
- Attach each record's identifier to its row, so a row can be traced back to the record it came from.
- Put every row in place in one go, rather than adding them one at a time.
- Fill the table body you were given, rather than building a new one to take its place.
- Do nothing at all when there are no records to show.
- Everything the table shows must come from the records you were given. Nothing should be fixed in advance.
