Javascript – How can I add an array of numbers recursively under the condition that the sum will not be more than 20?
For example, there is an array: [3, 8, 9, 2, 7, 5, 6, 5, 3, 11, 9, 17, 6, 5, 8, 4, 2, 7, 9, 12, 5, 16, 4] Algorithm: let arr = [] 3 + 8 + 9 +…