Array Reduce
we are using an arrow function to define the reduce function itself, and another arrow function to define the function passed to the forEach loop. The forEach l
we are using an arrow function to define the `reduce` function itself, and another arrow function to define the function passed to the `forEach` loop. The `forEach` loop iterates through each element of the `nums` array and applies the `reducer` function `fn` to it and the accumulated value. We update the accumulated value at each iteration, starting with the initial value `init`. Finally, we return the final accumulated value.\n\n# Code\n```\n/**\n * @param {number[]} nums\n * @param {Function} fn\n * @param {number} init\n * @return {number}\n */\nconst reduce = (nums, fn, init) => {\n  let val = init;\n  nums.forEach(num => {\n    val = fn(val, num);\n  });\n  return val;\n}\n\n```
['JavaScript']