I also forgot about destructuring as well. However, it does work without destructuring. I think you forgot to initialize your accumulator. You need to add the ,0 after the function to initialize the accumulator. Hope that helps!
I like this a lot! Readable functional coding! I dislike how functional coding tends to lead to a loss of names which makes the code more difficult to read since it increases cognitive load.
I also forgot about destructuring as well. However, it does work without destructuring. I think you forgot to initialize your accumulator. You need to add the
,0
after the function to initialize the accumulator. Hope that helps!I like this a lot! Readable functional coding! I dislike how functional coding tends to lead to a loss of names which makes the code more difficult to read since it increases cognitive load.
Not recursive; just saying ;)