$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · hard · #236

What is the output?

console.log([...'héllo'].length, '😀'.length);
  1. 5 1
  2. 6 2
  3. 5 2
  4. 6 1
Spreading iterates by code point (5), but .length counts UTF-16 units and the emoji is a surrogate pair.
Play Problem Solving ▸