GitHub 6248★

Get the average of an array

JavaScript version

const average = (arr) => arr.reduce((a, b) => a + b, 0) / arr.length;

TypeScript version

const average = (arr: number[]): number => arr.reduce((a, b) => a + b, 0) / arr.length;
Follow me on and to get more useful contents.