Code RoomUnicode length and reversal
HardPrep Room Coding #1761

Unicode length and reversal

Code reviewAlgorithms & data structuresSenior–Staff~30 min

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.

0:00 of about 30 min
Mark a line and say what kind of problem it is.0 findings
1function validate(s) {
2 if (s.length > 10) throw new Error('too long');
3 return s;
4}
5 
6function reverse(s) {
7 return s.split('').reverse().join('');
8}
9 
10// validate("\uD83D\uDE00 hi"); reverse("a\uD83D\uDE00b");
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.