Skip to content
On this page

sum

Returns the sum of an array of numbers.

Usage

ts
import { sum } from '@screaming/utils'

sum([1, 2, 3, 4, 5])
// 15
1
2
3
4

Type Definitions

ts
/**
 * @param array - The array of numbers.
 * @returns The sum.
 */
export declare function sum(array: readonly number[]): number
1
2
3
4
5