Skip to content

Instantly share code, notes, and snippets.

@hazmatzo
Created April 1, 2016 17:55
Show Gist options
  • Save hazmatzo/07b094ff9f0b41519da0d3e4b1b32fb0 to your computer and use it in GitHub Desktop.
Save hazmatzo/07b094ff9f0b41519da0d3e4b1b32fb0 to your computer and use it in GitHub Desktop.
People Function in ES5
function People() {
var self = this; // Some choose `that` instead of `self`.
self.size = 0;
setInterval(function addMorePeople() {
// The callback refers to the `self` variable of which
// the value is the expected object.
self.size++;
}, 1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment