--- id: 5d7925395888767e9304c082 title: Part 119 challengeType: 0 dashedName: part-119 --- # --description-- The `reduce` method takes a function with an accumulator and the current value. The accumulator is initially set to the value at index 0. The `reduce` method then goes through each element of the array after that, passing in the element as the current value and the result of the last call as the accumulator. For example, here's how to multiply all the value in an array: ```js [2, 3, 4].reduce((a, x) => a * x); // 24 ``` Using `reduce`, add a function `sum` to `spreadsheetFunctions`, which sums all values in the array passed to it. # --hints-- See description above for instructions. ```js assert( spreadsheetFunctions.sum([10, 5, 1, 3]) === 19 && code.includes('reduce') ); ``` # --seed-- ## --before-user-code-- ```html Spreadsheet
``` ## --after-user-code-- ```html ``` ## --seed-contents-- ```html ``` # --solutions-- ```html ```