-
Code const fn = (f) => (args) => args.reduce((f, arg) => f(arg), f); // ================================== const sum = fn(a => b => c => (a + b + c)); console.log(sum(1, 2, 3)); // 6 console.log(sum(1, 2)(3)); // 6 console.log(sum(1)(2)(3)); // 6 const doubleInc = sum(1)(1); console.log(doubleInc(4)); // 6
Output:
-
- All
- {{group.name}} ({{group.count}})
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}