Use reduce to sum an array

This is cleraer than inject(0).
Add rudimentary sort-by with js