DEV Community

Discussion on: Piping JavaScript

Collapse
kayis profile image
K (he/him) Author • Edited on

> In my mind, this can only work if addDays(2) actually returns a function.

This is what it does :)

A regular version of that function would look like that:

function addDays(amount, date) {...}

addDays(2, date);

A curried version looks like that:

const addDays = amount => date => {...};

addDays(2)(date);