sum
mathComputes the sum of the values in array.
Signature
sum(array: number[]): numberParameters
| Name | Type | Description |
|---|---|---|
array | number[] | The array to iterate over |
Returns
number - Returns the sum
Examples
Basic usage
import { sum } from 'dashlite'
const result = sum([4, 2, 8, 6])
console.log(result)Output:
20Empty array
import { sum } from 'dashlite'
const result = sum([])
console.log(result)Output:
0Available since version 1.0.0