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;