What is the difference between using a recursive function in Python and JS?
Advertisements Trying to use recursive function in JS, but code isn`t work: let arr = [6, 5, 3, 1, 1, 1, 1] function sum(ars, i) { if (ars.length == i) { return 0 } return ars[i] + sum(ars[1]) } console.log(sum(arr, 0)) // Output: 6 But the same code works in python: arr = [2,5,3,1,1,1,1] def… Read More What is the difference between using a recursive function in Python and JS?