I'll just sort it myself

alphacyberranger@sh.itjust.works to Programmer Humor@programming.dev – 909 points –
48

You are viewing a single comment

As annoying as this is, you are meant to use a comparer.

mapped.sort((a, b) => {
  if (a.value > b.value) {
    return 1;
  }
  if (a.value < b.value) {
    return -1;
  }
  return 0;
});

Stuff like that exists to remind us of the Java in JavaScript