← Code LabJavaScript0/50 solved · 0%
Patterns · hard

48. Transaction state machine

Model status transitions explicitly.

Write `next(state, event)` for states `idle → pending → confirmed|failed`. Unknown transitions return the current state unchanged.
Required in your answer: next