Code Room
Code reviewMedium
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.
Learn the concepts
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.