Created
September 13, 2017 06:50
-
-
Save jperasmus/02c10ec76aadf82614105d4fcc711540 to your computer and use it in GitHub Desktop.
Basic "compose" example
This file contains hidden or 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
const double = x => x * 2; | |
const square = x => x * x; | |
const plus3 = x => x + 3; | |
const composedFunction = compose(double, square, plus3); | |
const result = composedFunction(2); | |
// result = 50 | |
// 2 (plus3) => 5 (square) => 25 (double) => 50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment