Skip to content
TRTD

Fixture terms

The second lesson in the fixture programme.

On this page

Note

A structural component, allowed anywhere.

What this lesson exercises

Enough body structure for the lesson player's pattern-level tests: headings for the table of contents, fenced code for the highlighter, and an npm command for the package-manager tabs.

A code block

sum.ts
// The fixture's only function.
export function sum(a: number, b: number): number {
  return a + b;
}

A shell block

shell
npm install prettier

Try it live

The interactive runtime, embedded the way real lessons embed it — the e2e suite exercises the sandbox through this editor.

A markup playground

The iframe-backed variant — HTML and JS panes, with the preview as the output window. The e2e containment suite drives this one too.

Step through it

Annotated

sum.ts
  1. export function sum(values: number[]): number {Numbers in, one number out.
  2. return values.reduce((t, v) => t + v, 0);reduce folds the array into a total.
  3. }

Wrapping up

Press Ctrl + K to search from anywhere.

Nothing is locked — this just records where you have been.