Answer the question
In order to leave comments, you need to log in
How to stop function return recursion?
The recursive function must accumulate numbers into an array and be called with additional parentheses (as in the example below) . We want the function to return an array of args . This means that you need to come up with a condition for exiting the recursion. I can't figure out how.
function curry(...args) {
return (num) => curry(...args, num)
}
curry(2)(8)(5) // вернёт function, а должно быть [2, 8, 5]
curry(1)(0)(9)(3)(12) // вернёт function, а должно быть [1, 0, 9, 3, 12]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question