DEV Community

Discussion on: Functional JavaScript - Functors, Monads, and Promises

Collapse
 
plepe profile image
Stephan Bösch-Plepelits

Found a mistake:
[1, 2, 3].map(x => x + 1) //=> [2, 4, 6]

Correct result:
[2, 3, 4]

Correct function for the result above:
[1, 2, 3].map(x => x * 2) //=> [2, 4, 6]

Collapse
 
joelnet profile image
JavaScript Joel

Great catch! I was so used to typing x => x * 2 that I didn't even notice I was using x => x + 1.

Article has been corrected.

Cheers!