Backbone.JS Create()

The Backbone.JS Create() collection method creates a new instance of the model in the collection.

Syntax:

Collection.Create ( attribute, options )   

Parameters:
attribute: This parameter is used to specify the attributes of a model in a collection.
options: This parameter is used to specify the parameters like id, name, etc.

Example:

  

  
Example  
  
  
  
  
  
  
  
  

Output:

{"0":"create","1":{"name1":"Happy","name2":"Smiley"},"2":{"validate":true,"parse":true}}

Explanation:
In the above example, the Create() method creates “values” as an instance of the collection.