// in Person function
this.gender = gender;
// outer scope (gender will never be this value because it is overridden by the person constructor argument)
Person.prototype.gender = 'Person Gender';
Am I correct, or does the prototype.gender line have some other purpose than instantiating gender to a value that is immediately overridden by the passed in value (or undefined if no value is passed)?A way I'd prefer might look like this:
function Person = function(gender) {
this.gender = gender || 'neuter' //the sauce that defines a fallback
}Somebody should tell Mozilla, that there are no classes in JavaScript....
An interesting ressource, anyway.
(1) https://developer.mozilla.org/en/Introduction_to_Object-Orie...