Skip to content

Instantly share code, notes, and snippets.

@glauberramos
Created September 5, 2012 17:48
Show Gist options
  • Select an option

  • Save glauberramos/3641107 to your computer and use it in GitHub Desktop.

Select an option

Save glauberramos/3641107 to your computer and use it in GitHub Desktop.
Javascript Closure Example
var a = function() {
var b = 0;
return function() {
b = b + 1;
return b;
};
};
var d = a();
alert(d());
alert(d());
alert(d());
alert(d());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment