Skip to content

Instantly share code, notes, and snippets.

@daronwolff
Last active May 23, 2016 16:51
Show Gist options
  • Select an option

  • Save daronwolff/be4d110e65c88b40c0b2149846707ae6 to your computer and use it in GitHub Desktop.

Select an option

Save daronwolff/be4d110e65c88b40c0b2149846707ae6 to your computer and use it in GitHub Desktop.
Write a function that returns two functions to up/down counter
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