Code Room
Code reviewMediumcr-g290
Subject Repeated workLevel Mid–Senior~16 minCommon in Code quality & review interviewsIndustries Software development

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.

Talk through your review
Code to reviewjavascript
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.