Code Room
Code reviewMedium
Question
Review this JavaScript function that flags rows whose value exceeds a threshold derived from the dataset.
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 flagOutliers(rows) { const flagged = []; for (const row of rows) { const mean = rows.reduce((a, r) => a + r.value, 0) / rows.length; if (row.value > mean * 1.5) flagged.push(row); } return flagged;}Run or narrate your approach, then ask the coach.