A reproducible coding exercise

One function. Nine checks you can inspect.

Fix a small URL-slug function, then verify what changed. Run the starter and reference below, or open the same files in your editor. The browser and Node tests share the exact same inputs and expected outputs.

Download the exercise ZIPReady to run locally.

Incomplete starter

— / 9

Find the failures before you change code.

Reviewed reference

— / 9

A solution to this contract, not every slug problem.

The acceptance cases

Starter → reference

These results execute the supplied JavaScript in your browser. No AI model runs here, and no code is uploaded. They do not measure Cursor or Devin speed, accuracy or cost.

Run the same checks in your terminal

Requires Node.js 22 or later. Unzip the download, enter its folder and run:

node --test slugify.test.mjs

The starter intentionally fails seven cases. Ask your editor to read AGENTS.md, propose a fix, edit only starter.mjs and rerun the unchanged tests. Preserve your attempt before checking the reference:

cp starter.mjs my-attempt.mjs
cp reference.mjs starter.mjs
node --test slugify.test.mjs