Which ChatGPT model should I use to debug JavaScript?
Start with the bug you can reproduce. A failing input and clear error are a good fit for the default setting. If the bug depends on several steps, give ChatGPT the data flow and consider higher reasoning if your tab offers it.
Free model and reasoning recommendations in ChatGPT. You choose the settings and send.
Try it with a one-line bug
const prices = items.map((item) => item.price);
If items is null, reading .map throws. An object without a map method also throws when you call it. A null row throws when the callback reads its price. A row with a missing price gives you undefined for that entry.
Check the input with Array.isArray(items) when you expect an array. Then decide whether your app should skip invalid rows or report them. JavaScript reference for map
When you can reproduce the error
Start with the default setting. Give ChatGPT one failing input and ask for a test.
In JavaScript, items.map(i => i.price) throws when items is [{ price: 12 }, null]. Explain the error and show one fix that skips invalid rows and one that reports them. Include a test for each behavior.
When the bug depends on several steps
Consider a higher reasoning setting if available. Include the fetch and state-update code and a sanitized example of the API response.
My cart sometimes crashes on items.map(i => i.price) after navigation or a slow API response. Using the code and sample responses below, trace where items could become null or a non-array. Suggest how to reproduce each likely cause, what to log, and one test that would catch it.
Get a free recommendation before sending
Reasoning Choice suggests a model and reasoning level from the options available in your current ChatGPT tab and explains why. With free recommendations, you choose your settings and send the prompt yourself.
Optional paid Auto Mode starts when you press Send. It applies supported settings, verifies them before sending, and keeps your draft for review if it cannot confirm the settings.
Get Reasoning Choice for Chrome