Simple Statistics: Statistical methods in JavaScript for browsers and servers
simple-statistics.github.io
simple-statistics.github.io
Specifically, comments every other line quickly add up and take up valuable space. Some, like the one above `sumOfSquares` are, in my opinion, unnecessary. It's obvious from the variable name and that `for` loop what's going on there.
My experience is that the best way to make equations legible is to use their matrix form - matrices are easy to explain to anyone who can add and multiply.
I'm currently in a project that's built around a few calculations and we settled on matrices because it's a language that every team member, from the project owners to developers, understands.
Comments are basically free in most languages. Use them.
The maxSorted function for example is as trivial as it gets: https://github.com/simple-statistics/simple-statistics/blob/... It would be actually simpler for everyone without the abstraction.
Tom was super nice and way more helpful than he needed to be. Class act and great programmer/blogger: https://macwright.com/