Completed a first run at CalcStats in JavaScript