Lodash _.sum() Method
The _.sum() method is used to find the sum of the values in the array.
Parameters: This method accepts a single parameter as mentioned above and described below:
- array: This parameter holds the array to iterate over.
Return Value: This method returns the sum of the values in the array.
Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library into the file.