Loading problem…
Implement curry - convert a function into a curried version based on fn.length (its declared arity).
fn.fn.length, invoke fn and return its result.fn.length as the required argument count.this from the call that finally triggers execution.fn.length === 0, the curried function should execute on the first invocation.const add3 = (a, b, c) => a + b + c
const cAdd3 = curry(add3)
cAdd3(1)(2)(3) // 6
cAdd3(1, 2)(3) // 6
cAdd3(1)(2, 3) // 6
cAdd3(1, 2, 3, 4) // 6 (extra args allowed)