|
|
|
|
|
by qqqq2010
5526 days ago
|
|
It's ensuring a default value basically. If you instantiate a person without an argument and try to reference this.gender later, you'll throw a script error. This is just avoiding that. A way I'd prefer might look like this: function Person = function(gender) {
this.gender = gender || 'neuter' //the sauce that defines a fallback
}
|
|