GitHub 6248★

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);
Follow me on and to get more useful contents.