const average = (...args) => args.reduce((a, b) => a + b) / args.length;
average(1, 2, 3, 4);
// Result: 2.5
var sum = array.reduce((a, b) => a + b, 0); //get sum of all elements in array
var avg = (sum / array.length) || 0; //get average of all elements in array ;)
const sum = times.reduce((a, b) => a + b, 0);
const avg = (sum / times.length) || 0;
console.log(`The sum is: ${sum}. The average is: ${avg}.`);