🔥🔥Easy Simple JavaScript Solution 🔥🔥
\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    let
\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    let ans=init;\n    for(const i of nums){\n        ans=fn(ans,i);\n\n    }\n    return ans;\n};\n```
['JavaScript']