Spot the bug in label truncation

from String methods
Node 24 intermediate 4 min 1 issue to find

Find why this user-visible label truncator can return broken text.

JavaScript
function shortLabel(input) {
  if (input.length <= 8) return input;
  return `${input.slice(0, 8)}…`;
}
Open in playground
Report an error