StaffCoder
TypeScript
Vanilla TypeScriptTypeScript 7.0
6 modules · 24 challengesSign up
Module 4 · Rendering & DOM Construction

Course Review Comments

easy—No data yet

Problem statement

A list of user-submitted course reviews rendered into a single container on the page. The whole point of the exercise is safety and structure: text must render as text (never as HTML), a small whitelist of formatting must be applied structurally, and long reviews must collapse behind an expand control — using Vanilla TypeScript and standard DOM APIs.

Demo

The page, styles, mock data, and the reviews container are already scaffolded and wired. Only the pure helpers in src/js/commentModel.ts and the DOM renderers in src/js/renderComment.ts are missing — implement them so every test passes. Do not edit any other file.

What to implement

  • Show each review with the reviewer's name on top and their comment beneath it.
  • Show any code or tags that appear inside a review as visible text — it must never run or change the page.
  • Keep the line breaks in a review, so each line reads on its own row.
  • When a review has a link, show a small clickable link that opens in a new tab safely.
  • If the link does not look like a normal web address, do not show a link at all.
  • When a review is very long, show only the first part with a Show more button underneath.
  • When Show more is clicked, reveal the whole review and hide the button.
  • Leave the reviews you were given exactly as they are, and do not change the surrounding page.
  • Everything shown must come from the reviews you were given — nothing should be hardcoded.

More in Rendering & DOM Construction

See the module
Job Listing Board Implement renderRow, renderList, renderPanel, and mount to turn a typed job array into an Open Positions panel. Renderers must be pure (no document queries, no side effects) and return fresh nodes; renderList([]) returns a documented empty-state node; mount replaces container contents so repeat calls leave exactly one child.—No data yeteasyNotifications Feed Implement renderFeed and the four state renderers. renderFeed dispatches on a discriminated FeedState union (loading | empty | error | list), swaps the container's single child, and wires an onRetry callback into the error state that fires exactly once per click. Switching between states must leave no residue from the previous state.—No data yeteasyRecipe List Page Implement pure helpers (parseFilters, applyFilters, formatCount) plus renderCard and renderResults. The filter form combines a title search, difficulty select, and max-time cap under AND semantics; submits re-render only the results panel while the form retains submitted values; no-match renders a single empty-state node; cards are built by cloning a <template>.0%0 of 1 solvedeasy

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.