es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
17 lines • 479 B
TypeScript
//#region src/math/sum.d.ts
/**
* Calculates the sum of an array of numbers.
*
* This function takes an array of numbers and returns the sum of all the elements in the array.
*
* @param nums - An array of numbers to be summed.
* @returns The sum of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = sum(numbers);
* // result will be 15
*/
declare function sum(nums: readonly number[]): number;
//#endregion
export { sum };