just trying to find the sum in the array and can't figure out what is wrong with my code, if you can help that would be appreciated :)
function arraySum(arr, index) {
if (arr.length <= index)
return 0;
return (arraySum(arr, arr.length - 1) + arr[arr.length - 1]);
}
I'm trying to find the sum of the array using recursion. what is exactly wrong with my code :) if you can help that would be appreciated
ps index=0 arr.length =8