Skip to content

Instantly share code, notes, and snippets.

@mrosata
Created April 23, 2017 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrosata/882213b1cebcd2ef96336fe9cb81e9b2 to your computer and use it in GitHub Desktop.
Save mrosata/882213b1cebcd2ef96336fe9cb81e9b2 to your computer and use it in GitHub Desktop.
Explaination
// If we wrote a multiply function:
const multiply = (n, m) => n * m
// If we wrote an expression:
[ 1, 2, 3, 4, 5 ].map( (m) => multiply(10, m) )
// It would evaluate to:
[ 10, 20, 30, 40, 50 ]
// But we could also write that example like:
const multBy = (n) => (m) => n * m
// And then if we wrote an expression:
[ 1, 2, 3, 4, 5 ].map( multBy(10) )
// Because multiply(10) returns a function It would still evaluate to:
[ 10, 20, 30, 40, 50 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment