Course · Section 17: Modern JavaScript Development: Modules, Tooling, and Functional · Lecture 294: Declarative and Functional JavaScript Principles
A pagination hook returns just the rows for the current page. Implement `paginate(items, page, perPage)` returning the slice of `items` for the 1-based `page`. Pages past the end return an empty array.
+ 2 hidden tests run on Submit.
Each page is a contiguous window of size perPage. The start index is (page - 1) * perPage, and slice returns that window — automatically returning an empty array when the start is past the end.
Run your code to see results.