Functions·hard 30 min 120 XP
Custom Reduce
Reimplement Array.prototype.reduce as myReduce(array, reducer, initialValue) without using the built-in .reduce.
Examples
- myReduce([1,2,3], (sum, x) => sum + x, 0) → 6
Constraints
- Keep the required function name so the tests can find it
- Return a value instead of only logging it
- Do not mutate inputs unless the challenge asks you to
Custom Reduce · editor
Code runs in an isolated Web Worker with a 3-second timeout — no DOM access, and it can never hang the page.