ILM
7
About your code, you have this
where sum(arr, n-1)
returns a number and arr
is an array, you can’t sum a number to an array - do you maybe want to sum one of the items inside arr
?
this is a really comprehensive guide on recursion, it may be helpful to you: