sumBy()
Sums the value of a specific numeric property across all objects in an array.
Returns 0 if the result is not a number (guards against NaN from missing properties).
Kind: global function
Returns: number - The total sum, or 0 if the result is not a valid number.
| Param | Type | Description |
|---|---|---|
| objects | Array.<Object> | The array of objects. |
| sumByProperty | string | Dot-notation path to the numeric property. |
Example
ARM.sumBy(orderItems, 'attributes.quantity')Last updated on