Practice ยท 2 of 3
Offset Pagination
Write paginate(items, query) โ query is { limit?, offset? } (limit defaults 10, max 100; offset defaults 0). Return { results, total, next }: results is the sliced page; total is items.length; next is the next offset (as a number) when more items remain, else null. Guard against negative and non-integer inputs.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: REST Resource Design โ Practice