Refresh

This website www.w3schools.blog/backbonejs-initialize-collection is currently offline. Cloudflare's Always Online™ shows a snapshot of this web page from the Internet Archive's Wayback Machine. To check for the live version, click Refresh.

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.