Javascript Array.prototype.sort() ...

... by default [converts the array elements into strings and sorts them by their UTF-8 Codepoints 🤪](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)!

```
[-7, 2, 10, -1].sort()
[-1, -7, 10, 2]
```

You can pass a function to `sort` to override the behavior:
```
[-7, 2, 10, -1].sort(function(a,b){ return a - b })
[-7, -1, 2, 10]
```

Phew.

alexanderpresber
September 1, 2020
