Practice ยท 2 of 3
Query Pipeline
Write createQuery(records) that RETURNS a function query(opts). Each record has { id, score }. opts may contain:
- minScore, maxScore โ inclusive score range; missing bounds are ignored
- sortBy โ "score" (default) or "id"
- order โ "asc" (default) or "desc"; ties keep original order
- page (1-based, default 1), perPage (default 2)
query RETURNS { items, total, page, pages } where items is the current page of results (empty array when the page is out of range) and pages is Math.ceil(total / perPage) (0 when there are no results).
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Mini Build: Data Explorer