In this article I’ll quickly introduce you to currying, it’s purpose, and show you how to understand it with plain and simple code.
Currying is the process of converting a function of multiple arguments to a chain of functions of one argument. Like so:
const createUser = (firstName, lastName) =>
`${firstName} ${lastName}`
// becomes
const createUser = (firstName) => (lastName) =>
`${firstName} ${lastName}`
But it’s not comfortable to do those manipulations manually every time we need to break down our functions througn currying. So we make curry function that can do it for us.
#programming #javascript