3 ms·
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
by i2 13y ago
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; }
- ceautery 13y agoA bug in my code doesn't make javascript horrible, it makes me horrible for rushing to illustrate a point instead of just harrumphing internally and finishing my coffee. Good catch.