Design Patterns · Middle · Question 72 of 75
What is currying / partial application useful for?
const log = (level) => (message) => console.log(level, message);
const warn = log('warn');- ✓Correct answer: Creating specialized functions by fixing some arguments in advance
- 2Making functions run faster
- 3Removing arguments from functions
Explanation
It pairs well with pipelines and event handlers, e.g. onClick={select(id)}.