Property Change Events
For this code example below, I created a counter object. This object has an internal count variable.
onChange is for printing but it can be set to whatever you want Function wise but doesn't need to be set.
For the getter all I do is up the count by 1. For the setter all I do is print and set the value. Fairly simple example but proves the point and demonstrates how it could be done if you wanted to implement such a feature. I am not sure how supported it is in older browsers.
Scope is passed down from any parent function. This can be dangerous if you aren't careful. Mixing scopes can be powerful but troublesome if your variables are not named appropriately.
So there you have it. If you aren't paying close attention to what the language is doing, you might just have a person that is born in 1900's or 2000's. And if you don't have your scoping right, you might not even get their birthday set in the first place.
Get the latest posts delivered right to your inbox