Act as a JavaScript expert. What should happen: [expected behaviour] What actually happens: [bug] Code: ```js [paste] ``` Explain the async flow step by step, identify the bug (race condition, missing await, unhandled rejection, etc.), provide fixed code, and suggest patterns to prevent it (Promise.all, AbortControlle…
Debug async JavaScript
Fix race conditions, unhandled promises and ordering bugs in async JavaScript.