Easy to understand, less memory consuming solution
Intuition\nGiven an integer array nums, a reducer function fn, and an initial value init, return a reduced array.\n\nA reduced array is created by applying the 
# Intuition\nGiven an integer array nums, a reducer function fn, and an initial value init, return a reduced array.\n\nA reduced array is created by applying the following operation: val = fn(init, nums[0]), val = fn(val, nums[1]), val = fn(val, nums[2]), ... until every element in the array has been processed. The final value of val is returned\n\n# Code\n```\n/**\n * @param {number[]} nums\n * @param {Function} fn\n * @param {number} init\n * @return {number}\n */\nvar reduce = function(nums, fn, init) {\n    for(i = 0;i<nums.length;i++){\n        init = fn(init,nums[i]);\n        \n    }\n    return init;\n};\n```
['JavaScript']