Best Solution 
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```javascript []
/**
 * @param {number[]} nums
 * @param {Function} fn
 * @param {number} init
 * @return {number}
 */
var reduce = function(nums, fn, init)
/* Function reduce banaya jo:
nums → Array lega.
fn → Function jo har element pe apply hoga.
init → Shuruaati value jo result me store hoga.
*/

 {
    let result = init;
// result variable ko init se initialize kiya, jo computation start karega.
    for(let i=0; i < nums.length; i++)
/*  Loop chalaya jo array ke har element pe chalega.

i → Index ko represent karega.
nums[i] → Current element ko represent karega.
*/


{
        result = fn(result, nums[i]);
/* Har step pe function apply hoga:

fn(result, nums[i]) → Function ko current result aur current element ke saath call kar rahe hain.
result = ... → Jo bhi function return karega, woh result me store ho jayega.
*/

    }
    return result;
};
```
['JavaScript']