Code Room
Code reviewMedium
Question
Review this JavaScript function used to size a dependency tree.
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
function countDeps(node, graph) { if (!graph[node] || graph[node].length === 0) return 1; let total = 1; for (const child of graph[node]) { total += countDeps(child, graph); } return total;}Run or narrate your approach, then ask the coach.