Date

“Math” Methods

_.sum(array)

source npm package

Computes the sum of the values in array.

引入版本

3.4.0

参数
array (Array) : The array to iterate over.

返回值
(number) : Returns the sum.

示例
_.sum([4, 2, 8, 6]);
// => 20