Sums the given array of numbers.

Type signature

(xs: number[]) => number

Examples

sum([1, 2, 3, 4, 5]);
// ⇒ 15
Try in REPL

Questions

  • How to sum elements of an array?

TypeScript sourceJavaScript source