Command Palette

Search for a command to run...

Hectal
Phase 13: Cost, Limits and Production
AI Frontend · Exercise 6 of 6 Previous
Advanced

Build the Usage Meter

The route allows 3 questions. Every answer carries the headers x-quota-used and x-quota-limit. Clicking #ask shows the answer in #answer and updates #meter to N of 3 questions left today (N = limit - used).

When exactly one is left, #near must read Last question for today. When none is left, #limit must read You have used all 3 questions for today. and #ask must be disabled.

What Check tests

  1. After the 1st question the meter says 2 of 3 questions left today
  2. After the 2nd question the last-question warning shows
  3. After the 3rd question the limit message shows and Ask is disabled

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.