Get the sum of an array of numbers
JavaScript version
const sum = (arr) => arr.reduce((a, b) => a + b, 0);
TypeScript version
const sum = (arr: number[]): number => arr.reduce((a, b) => a + b, 0);
JavaScript version
const sum = (arr) => arr.reduce((a, b) => a + b, 0);
TypeScript version
const sum = (arr: number[]): number => arr.reduce((a, b) => a + b, 0);