All challenges

TypeScript · easy

Then chain

#27

Situation

Inventory badge renders "[object Promise]" on the warehouse TV. stockLabel returns the Promise itself instead of waiting for the SKU value. Wait for the number, then build the label string.

Objective

The inventory badge needs the finished label string, not a Promise on screen. stockLabel("sku-1") must resolve to "SKU sku-1: 3 left".

The repo at start

workspace/
└── src/
    └── stock.ts   (.then forgotten; UI shows [object Promise])

Checks you will turn green

  • exports stockLabel
  • stockLabel resolves to the SKU line
  • a sold out SKU reads 0 left

Concepts

promises

Play it in your terminal

With sharpen installed, this command opens exactly this challenge in your local arena:

sharpen 27

First time? The full install is right below.

How to play

  1. 1 Install Claude Code if you do not have it yet: claude.com/claude-code
  2. 2 Install sharpen from npm:
    npm install -g @juanwmedia/sharpen
  3. 3 Then launch it; the arena opens in your browser:
    sharpen 27
  4. or Or try it without installing anything:
    npx @juanwmedia/sharpen 27
  5. 4 And to update when a new version ships:
    sharpen update