Computes the sum of the values in `array`.
sum([4, 2, 8, 6])
// => 20
| Name | Type | Attribute | Description |
|---|---|---|---|
| array | The array to iterate over. |
{
"comment": "/**\r\n * Computes the sum of the values in `array`.\r\n *\r\n * @since 3.4.0\r\n * @category Math\r\n * @param {Array} array The array to iterate over.\r\n * @returns {number} Returns the sum.\r\n * @example\r\n *\r\n * sum([4, 2, 8, 6])\r\n * // => 20\r\n */",
"meta": {
"range": [
288,
403
],
"filename": "sum.js",
"lineno": 15,
"path": "C:\\Users\\beaujeup\\projects\\jsdoc-template\\examples\\lodash\\lodash-repo",
"code": {
"id": "astnode100008871",
"name": "sum",
"type": "FunctionDeclaration",
"paramnames": [
"array"
]
},
"vars": {
"": null
}
},
"description": "Computes the sum of the values in `array`.",
"since": "3.4.0",
"tags": [
{
"originalTitle": "category",
"title": "category",
"text": "Math",
"value": "Math"
}
],
"params": [
{
"type": {
"names": [
"Array"
]
},
"description": "The array to iterate over.",
"name": "array"
}
],
"returns": [
{
"type": {
"names": [
"number"
]
},
"description": "Returns the sum."
}
],
"examples": [
"sum([4, 2, 8, 6])\r// => 20"
],
"name": "sum",
"longname": "sum",
"kind": "function",
"scope": "global",
"___id": "T000002R000807",
"___s": true,
"filepath": "sum.js"
}