fCC - Basic JavaScript: Replace Loops using Recursion
I don't understand this. I got through this exercise using the hints given by fCC but I still don't really get it
Basic JavaScript: Replace Loops using Recursion
Recursion is the concept that a function can be expressed in terms of itself. To help un...
hashnode.com
fengxh
front-end developer
You can use
reduceto finish the multiply action.function multiply(arr) { if (arr.length <= 0) return 1; return arr.reduce((result, number) => { return result * number; }, 1); }Another thing about recursion is tail optimization, it can reduce the usage of call stack to minimize space complexity.