Backbone.js Model Constructor / InitializeThe Backbone.js initialize function is invoked by a class constructor while a model instance is created. When model instance is created, the class's constructor gets called. Syntax: Parameter explanation:attributes: Attributes define properties of a model, when creating instance of that model. options: These are the options such as id, name etc used with attributes when model is created. Let's take an example. See this example: Test it NowOutput: Save the above code in initialize.html file and open this file in a new browser. Next TopicBackbone.js Get |