Eu faria algo assim:
const list = [0, 1, 2, 3];
const sum = (list) => list.reduce((a, b) => a + b, 0);
const average = (list) => (sum(list) / list.length) || 0;
console.log(average(list)); // 1.5
Eu faria algo assim:
const list = [0, 1, 2, 3];
const sum = (list) => list.reduce((a, b) => a + b, 0);
const average = (list) => (sum(list) / list.length) || 0;
console.log(average(list)); // 1.5