Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT Copy prompt I am reading "A script queues a zero-delay timer, queues `Promise.resolve().then(() => log.push("microtask"))`, and then pushes `"sync"`. Which final order is correct?" on CodeWiki (https://codewiki.com/practice/mcq/javascript/checkpoint-3/checkpoint-3-event-loop-order/).
Context (verbatim from the page):
"""
A script queues a zero-delay timer, queues `Promise.resolve().then(() => log.push("microtask"))`, and then pushes `"sync"`. Which final order is correct?
`["sync", "microtask", "timer"]`
`["sync", "timer", "microtask"]`
`["microtask", "sync", "timer"]`
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in JavaScript. Where you are unsure, say so.