Last active
May 23, 2016 16:51
-
-
Save daronwolff/be4d110e65c88b40c0b2149846707ae6 to your computer and use it in GitHub Desktop.
Write a function that returns two functions to up/down counter
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
| var counterf = (function(n){ | |
| var inc = function() { | |
| return n += 1; | |
| }; | |
| var dec = function() { | |
| return n -= 1; | |
| }; | |
| return { | |
| dec: dec, | |
| inc: inc | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment