Simple solution using Array.forEach() method.
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   
# 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    if(nums.length){nums.forEach(num=> init = fn(init, num))}\n    return init\n};\n```
['JavaScript']