I am using Backbone in a mobile project. Say I have a pattern class similar to this.
var Person = Backbone.extend({ });
The Person class contains the following properties firstName , lastName , age and gender . I want to specify all these properties in a class. Thus, other developers know what properties they should set for the instance. After looking at the documentation that I see, there is a property called defaults that I could use.
var Person = Backbone.extend({ defaults: { firstName: '', lastName: '', age: null, gender: null } });
But I see that the purpose of the defaults property is another right? Do not let people know what properties the class contains. Is there a better way to achieve this?
source share