Code Room
Code reviewHardcr-g125
Subject UnicodeLevel Senior–Staff~30 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Review this JavaScript that enforces a 10-'character' limit and reverses a string.

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 validate(s) {  if (s.length > 10) throw new Error('too long');  return s;} function reverse(s) {  return s.split('').reverse().join('');} // validate("\uD83D\uDE00 hi");  reverse("a\uD83D\uDE00b");
Run or narrate your approach, then ask the coach.