Backbone.JS Initialize() collection

The Backbone.JS Initialize() collection method is used to create a model instance.

Syntax:

Backbone.Collection.Initialize ()

Example:

  

  
Initialize Collection Example  
  
  
  
  
  
  
  
  

Output:

Hello World
[{"name":"Jim","age":10}]

Explanation: In the above example, the model ‘X’ includes the default values and is extended using the Backbone.Model class. Here, the model instance is invoked by defining the initialize function, and ‘Y’ is a collection instance.

Please follow and like us:
Content Protection by DMCA.com