Spot the problem in this AI code
JavaScript (Node). The task: "Write a function that adds up the order counts for a list of user IDs." Read the code, then pick what goes wrong.
// Adds up the order counts for a list of users
async function totalOrders(userIds, fetchOrderCount) {
let total = 0;
userIds.forEach(async (id) => {
const count = await fetchOrderCount(id);
total += count;
});
return total;
}
module.exports = { totalOrders };
We call totalOrders for 3 users. What goes wrong?
Show the answerHide the answer
Answer C: It returns 0, because forEach does not wait for the async callbacks
We ran it with counts of 3, 5 and 2 for users u1, u2 and u3, so the expected total is 10. It printed total: 0, because forEach starts each async callback and moves on, and the function returns before any await finishes. Swapping forEach for a for...of loop, so each await finishes before the next one starts, printed total: 10.
// Adds up the order counts for a list of users
async function totalOrders(userIds, fetchOrderCount) {
let total = 0;
for (const id of userIds) {
const count = await fetchOrderCount(id);
total += count;
}
return total;
}
module.exports = { totalOrders };
Explain it at your depth
The code is already in the box below. Pick a level and press Explain it, and Vibe explains it in plain English. Free, no account.
Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.
Vibe12 lines selected
Press Explain it for the sample, or paste your own code first.
Explain code beside your editor
When your AI tool writes code, select the code in any app and press the shortcut. On a Mac that's Control+U, not Command+U (⌘U only works in Cursor and VS Code with the editor bridge). On Windows it's Ctrl+Alt+U. Vibe explains it beside your editor, you can ask it why, and Test me checks that you followed. Unvibe is a free app for Mac and Windows.
Install on Mac
curl -fsSL https://unvibe.site/install.sh | bashPaste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.
Or download the .dmg · Intel Mac build · SHA-256 checksums
No install warning? Use Unvibe in your browser
Opening the .dmg the first time
- Open the .dmg and drag Unvibe to Applications.
- Open it once; macOS says it can't verify it. Click Done, not the blue Move to Trash.

Real screen, macOS 26. On macOS 15 the two buttons sit side by side. - System Settings › Privacy & Security, scroll down to Security, then press Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.

Real screen, macOS 15
The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open