Course · Section 17: Modern JavaScript Development: Modules, Tooling, and Functional · Lecture 294: Declarative and Functional JavaScript Principles
Implement `pagination(state, action)` where `state` is `{ page, total }` and `action` is the string `next` or `prev`. Clamp `page` to the range `1..total`.
+ 1 hidden test run on Submit.
Clamping with Math.min(page + 1, total) and Math.max(page - 1, 1) keeps pagination within bounds while returning new state objects.
Run your code to see results.