Created
April 1, 2016 17:55
-
-
Save hazmatzo/07b094ff9f0b41519da0d3e4b1b32fb0 to your computer and use it in GitHub Desktop.
People Function in ES5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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