CursorBot logoCursorBot

JavaScript, starting from the code that misbehaves

Language questions are easier to answer against a snippet: equality, async order, mutation, or a closure that captured the wrong value.

Be specific about the runtime

Say whether the code runs in a browser, Node, or both. APIs and module rules differ.

Include the unexpected value if you have it. “It logs the wrong thing” is less useful than the actual log line.

Example prompt

Explain why this loop logs 3 three times, and rewrite it so each callback sees its own index.

Questions

Can it generate tests too?

Yes. Ask for unit tests after the behavior is clear, and run them yourself.

Start with CursorBot