All challenges

TypeScript · easy

Stringly id

#19

Situation

The ledger is joining an invoice id to an amount instead of doing arithmetic. "1042" + 10 becomes "104210", which could send payment to the wrong invoice. An id must be numeric before money math begins.

Objective

Return the invoice number plus the delta, not a concatenated string. "1042" plus 10 returns the number 1052; an invalid id such as "nope" returns null.

The repo at start

workspace/
└── src/
    └── ledger.ts   (adds strings like a drunk Excel)

Checks you will turn green

  • exports bumpAmount
  • numeric id bumps by delta
  • garbage id returns null

Concepts

typescriptcoercion

Play it in your terminal

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

sharpen 19

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 19
  4. or Or try it without installing anything:
    npx @juanwmedia/sharpen 19
  5. 4 And to update when a new version ships:
    sharpen update