Nested callbacks make code hard to read and to reason about errors. Interviewers want to hear concrete strategies: flatten with named functions, use Promises with .then() chains, or prefer async/await with try/catch. For generator-based flows, libraries historically wrapped yield with thunk runners — today async/await is the default answer.
util.promisify or manual new Promise so you can await them..catch() once at the end of the chain for a single error sink.function loadUser(id, cb) style units and compose them.async/for await, Promise.all / allSettled, or tiny modules like async (series/waterfall) when you need patterns beyond raw callbacks.const fs = require("fs").promises;
async function readConfig(path) {
try {
const raw = await fs.readFile(path, "utf8");
return JSON.parse(raw);
} catch (err) {
console.error("config failed", err);
throw err;
}
}Having a tech or coding interview? Check 29 JavaScript & Node.js interview questions.