Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Commit

Permalink
Use reduce with initial value #286
Browse files Browse the repository at this point in the history
  • Loading branch information
clemens-tolboom committed Jun 7, 2016
1 parent 0277f9b commit 70723d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bot.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ var userInterface = window.userInterface = (function() {

if (bot.scores.length === 0) return;

var avg = Math.round(bot.scores.reduce(function (a, b) { return a.score + b.score; }) /
var avg = Math.round(bot.scores.reduce(function (a, b) { return a + b.score; }, 0) /
(bot.scores.length));

var median = Math.round((bot.scores[Math.floor((bot.scores.length - 1) / 2)].score +
Expand Down

0 comments on commit 70723d7

Please sign in to comment.