Skip to content

Instantly share code, notes, and snippets.

@bigbookpl
Created February 4, 2016 22:34
Show Gist options
  • Select an option

  • Save bigbookpl/ac3d4d7afb8235035d20 to your computer and use it in GitHub Desktop.

Select an option

Save bigbookpl/ac3d4d7afb8235035d20 to your computer and use it in GitHub Desktop.
Clousure JS
var minus = function(){
var value = 0;
var min = function(){
value -= 1;
return value;
}
var get_value = function(){
return value;
}
return {
min : function(){ value -= 1; return true;},
get : function(){ return value;}
}
}();
console.log(minus.min());
console.log(minus.min());
console.log(minus.min());
console.log(minus.min());
console.log(minus.get());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment