Fill out the following Markup for a leetcode solution submission. The solution is a one-liner with a score of 90% Performance and 50% Memory. The solution should not use the buildin javascript reduce method. The idea was to try and make the solution a one-liner for fun.

# 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
```
/**
 * @param {number[]} nums
 * @param {Function} fn
 * @param {number} init
 * @return {number}
 */
var reduce = (nums, fn, init) => nums.length == 0 ? init : nums.forEach(value => init = fn(init, value)) ?? init;
```