DEV Community


Comment from a deleted article or podcast


const getProduct = a => b => 
    new Promise((resolve, reject) => setTimeout(() => resolve(a * b), 1000))

const printFinalResult = result => console.log('final result', result);

// execute


Enter fullscreen mode Exit fullscreen mode

Altough I did find it helpful.
I think ppl that don't like the FP flow might find the thenables more complicated. For me it's the other way around.

notes: The technique of returning a function from a function is called higher order function, which allows you to do a partial-application of a function, something very common on FP languages/frameworks/libraries. The extent of this (when used up until the last parameter) is called currying.