Created
April 23, 2017 17:22
-
-
Save mrosata/882213b1cebcd2ef96336fe9cb81e9b2 to your computer and use it in GitHub Desktop.
Explaination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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