Course · Section 10: A Closer Look at Functions · Lecture 137: First-Class and Higher-Order Functions
Implement `myReduce(nums, op, initial)` that folds `nums` with the named operation `op` (`sum` or `product`) starting from `initial`.
+ 1 hidden test run on Submit.
A custom fold selects a binary operation by name and reduces the array from the given initial value.
Run your code to see results.