Code Room
Code reviewMediumcr-g334
Subject UnicodeLevel Mid–Senior~18 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this JavaScript that enforces a 280-'character' post limit, hard-caps the text, and reports how many characters remain.

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
const MAX = 280; function enforceLimit(text) {  if (text.length > MAX) {    text = text.slice(0, MAX);   // hard cap to fit  }  return {    text,    remaining: MAX - text.length,    overLimit: text.length > MAX,  };} // enforceLimit('\uD83D\uDE00'.repeat(200))
Run or narrate your approach, then ask the coach.