All challenges

TypeScript · easy

Tip jar lies

#16

Situation

Friday tip-out. The jar UI shows "$100.00" for a hundred cents. Finance will not find that cute. formatTip forgot that money has a denominator. Fix the math before someone screenshots the dashboard for Slack.

Objective

Show tip amounts in dollars, not raw cents. formatTip(100) must return "$1.00"; formatTip(0) must return "$0.00".

The repo at start

workspace/
└── src/
    └── tip.ts   (formatTip is cooking the books)

Checks you will turn green

  • exports formatTip
  • formatTip(100) returns $1.00
  • formatTip(0) returns $0.00

Concepts

functionsnumbersstrings

Play it in your terminal

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

sharpen 16

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