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');

Explanation

It pairs well with pipelines and event handlers, e.g. onClick={select(id)}.

Further reading

Problem with a question

Design Patterns · Middle · question 72

Test yourself

Take the Design Patterns · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz