Skip to content

Instantly share code, notes, and snippets.

@cocodrino
Created June 16, 2012 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cocodrino/2941992 to your computer and use it in GitHub Desktop.
Save cocodrino/2941992 to your computer and use it in GitHub Desktop.
code blog --clausuras part1
var aumentar_valor = function(x){
var numero = x;
return function(){
return numero+=1;
};
};
var add_user = aumentar_valor(0);
console.log(add_user());
console.log(add_user());
console.log(add_user());
//imprime
1
2
3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment