Comment

Comment by i2

Except it is, because your code doesn't work:

  > [10, 1, 5, 1, 10, 10, 1, 5, 5, 5, 10].sort(byNum)
  > [10, 10, 5, 1, 10, 1, 1, 5, 5, 5, 10]
The right way is

  > function byNum(a, b) { return a - b; }
parent i2 13 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton