Calculate custom averages for Rubik's Cube timing.
Easy to understand and use
An array with times in 1/10 seconds. Example:
let times = [{
time: 10
},
{
time: 50
},
{
time: 47
}];
calcAvg(averageOf, calculateOneAverage, index);
'averageOf' is the number of time values to include in the average calculation.
'calculateOneAverage' is a boolean indicating whether to calculate just one average or irritate over the whole time array.
'index' is the starting index for calculating a single average when 'calculateOneAverage' is true.
console.log(calcAvg(5, true, 2);