Created
October 31, 2018 11:03
-
-
Save ufocoder/e4331b01e8f60a50b33cb9a6b8e0932f to your computer and use it in GitHub Desktop.
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
| function rememberX (x) { | |
| return function getX () { | |
| return x; | |
| }; | |
| } | |
| // ES6 version might look like the following | |
| // const rememberX = x => () => x; | |
| const get42 = rememberX(42); | |
| const get36 = rememberX(36); | |
| const get18 = rememberX(18); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment