Practice ยท 3 of 3
Latest Search Wins
Write createSearcher(runQuery) that mimics search-as-you-type. It RETURNS { search, result }. search(term) starts runQuery(term) (returning a promise), aborts/cancels any PREVIOUS in-flight search by marking it stale, and remembers this call as current. result is an async function awaiting the CURRENT search and returning its value โ a stale (superseded) search must never update the result.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Cancellation โ Practice