Last active
October 9, 2016 19:50
-
-
Save jtulk/920e4e1228d4de4bab1b30f972bebc60 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
| // `num` now exists within the closure created by | |
| // add, and will be available in any returned function | |
| function add(num) { | |
| // this returned function will wait for execution with an | |
| // argument to be provided later | |
| return function partial(otherNum){ | |
| // return the sum of the two arguments | |
| return num + otherNum | |
| } | |
| } | |
| const stepOne = add(3) | |
| const stepTwo = stepOne(5) | |
| console.log(stepTwo) | |
| const combo = add(5)(10) | |
| console.log(combo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment