Code Room
Code reviewMedium
Question
Review this JavaScript service-to-service call.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
const INV_BASE = "https://inv.internal"; async function fetchInventory(sku) { const res = await fetch(`${INV_BASE}/sku/${sku}`); if (!res.ok) { throw new Error(`inventory ${res.status}`); } return res.json();} async function checkout(cart) { const stock = await Promise.all( cart.items.map((i) => fetchInventory(i.sku)) ); return reserveAll(cart, stock);}Run or narrate your approach, then ask the coach.