So I need to solve this problem STRICTLY using recursion
// 2. Compute the sum of an array of integers.
// sum([1,2,3,4,5,6]); // 21And then I'm testing this solution in PythonLive
var sum = function(array) {
  if(array.length===0){
    return array
    }
  
  return array.slice(0,array.length)+sum(array.pop())
};
sum([1,2,3,4,5,6]);Then at step 6 it says "TypeError: array.slice is not a function"
I don't understand why if it already worked taking 6 off the array and returning the remaining array...
Can someone explain me what am I doing wrong please?
thanks! :)
 
     
     
     
    