Advanced
Interview classics: Promise.all and debounce
Write the two most-asked async functions from Topic 15.7, without using Promise.all, allSettled, race or any inside them.
1. promiseAll(iterable) returns a promise of all results in input order. It accepts any iterable (arrays, Sets) and plain values, resolves [] for empty input, and rejects with the first rejection.
2. debounce(fn, ms) returns a function that runs fn only after calls have stopped for ms milliseconds, with the latest arguments and the caller's this.
Then make the search box show Searching for: <text> in #out 200 ms after the user stops typing.
What Check tests
promiseAllkeeps input order and accepts plain valuespromiseAll([])resolves to an empty arraypromiseAllrejects with the first errorpromiseAllaccepts any iterable, such as a Setdebounceruns once, with the latest arguments, after calls stopdebouncekeepsthis- The search box updates 200 ms after typing stops
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.