๐ WAYPOINT LESSON
Checkpoint: Data Explorer Core
โญโญ intermediateโณ 20 min read๐ Lesson 63 of 143
Combine closures, higher-order functions, Map/Set, destructuring, and error handling into the core of a small data explorer.
Six lessons in, you now own the JavaScript layer real applications are written in: closures for private state, higher-order functions for data flow, Map and Set for indexed lookups, destructuring for clean extraction, and deliberate error handling.
No new theory here. The challenge below asks you to combine all five into the core of a small data explorer โ grouping, deduplication, summarizing, and safe access โ the same shape of code the module project builds on.
Requirements:
groupBy(records, keyFn)โ returns a plain object mapping each key to the array of records with that key.uniqueBy(records, keyFn)โ returns the records deduplicated by key, keeping the first occurrence of each.summarize(records)โ returns{ count, avgScore, top }whereavgScoreis the mean of thescorefields andtopis the record with the highest score. An empty list yields{ count: 0, avgScore: 0, top: null }.safeGet(records, index)โ returns the record atindex, ornullfor out-of-range or non-integer indexes. It must never throw.
Take your time โ the tests check each function separately, so you can build and verify them one at a time.
โก Now practice
Ready to CodeMini Build: Data ExplorerBuild the explorer layer on top of the checkpoint core: a Map-backed index, a filter-sort-paginate query pipeline, and CSV export.
3 challenges ยท ยท ~25 min