Fix - API: `average()` needs an initial value

Fixes #257
pull/260/head
Allan Jardine 9 years ago
parent 3a2386ee0b
commit 427969e6d9

@ -25,7 +25,7 @@ jQuery.fn.dataTable.Api.register( 'average()', function () {
var data = this.flatten(); var data = this.flatten();
var sum = data.reduce( function ( a, b ) { var sum = data.reduce( function ( a, b ) {
return (a*1) + (b*1); // cast values in-case they are strings return (a*1) + (b*1); // cast values in-case they are strings
} ); }, 0 );
return sum / data.length; return sum / data.length;
} ); } );

Loading…
Cancel
Save