Calculate the sum of numbers from 1 to n using recursion
(function(){ // Calculate the sum of numbers from 1 to n using recursion. const getSum = (arr) => { if (arr.length < 1) { return 0; } return arr.pop() + getSum(arr); }; const a = [1, 2, 3, 5]; console.log(getSum(a)) })();