Skip to content

Instantly share code, notes, and snippets.

@ovidiucs
Created April 11, 2014 00:42
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 ovidiucs/10434647 to your computer and use it in GitHub Desktop.
Save ovidiucs/10434647 to your computer and use it in GitHub Desktop.
var myClosure = function() {
var date = new Date();
var nested = function() {
return date.getMilliseconds();
};
return {
foo: nested
};
};
var display = function () {
var output = document.getElementById("Output");
var closure = new myClosure();
output.innerHTML = closure.foo();
window.setTimeout(function () {
output.innerHTML += "<br />" + closure.foo();
}, 74);
};
display();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment