Freeweights
Library
Rep 1/24 · Tests run for real, in a sandboxed worker in this tab.
Local session: Qwen Coder runs in your browser via WebGPU — your code never leaves this device. Tests run for real, in a sandboxed worker in this tab.

Your coach isn't loaded yet

Pick a weight class and download it once — afterwards it runs offline, on your GPU. No API key, ever.

● red·values.ts · 526 chars
limit: 8,000
Loading editor…
Test results

Tests haven't run yet. Read them in the Tests tab, then make them pass — ⌘⏎ runs them.

Foundations · chapter 1

1. Values & Types

The idea

Everything starts with values. TypeScript has one number type for both integers and decimals, so integer division is something you do (Math.floor), not a type you pick. Strings are immutable — every "change" builds a new one.

Cheat sheet

  • const by default, let only when you reassign. var never.
  • number covers 3 and 3.5; Math.floor(a / b) and a % b give quotient and remainder.
  • Annotate function signatures: function f(c: number): number.
  • s.toUpperCase(), s[0] for the first character, + to concatenate.
  • Return two values as a tuple type: [number, number].

Watch out

  • / always produces a decimal: 7 / 2 is 3.5, never 3.
  • Floating point is approximate — 0.1 + 0.2 !== 0.3. The tests use toBeCloseTo where decimals appear.

Memory hook

"const until it complains" — start every binding as const; the compiler tells you when you genuinely need let.

Red → Green → Refactor: run the tests first; each failing name tells you which function to bring to life.

Hints · stuck is part of the method

Reference solution