Skip to main content

Practice ยท 2 of 3

Paginated Lister

CHALLENGE
Difficulty: intermediate+25 XP

Write async function fetchAllPages(fetchPage, maxPages) โ€” fetchPage(n) returns a promise for { items, hasMore }. Collect items page by page STARTING AT PAGE 1, stopping when hasMore is false or maxPages pages have been fetched (safety bound). RETURN all collected items in page order. Sequential is correct here: each request needs the previous page's verdict.

Back to lesson: Practice: fetch & Pagination โ€” Practice