Backbone.JS Push()

The Backbone.JS Push() collection method push the models to a collection, which simply means that it adds a model to the end of a collection.

Syntax:

Backbone.Collection.Push ( models, options )   

Parameters:
models: This parameter is used to specify the models to be Pushed to the collection.
options: This parameter is used to specify the model types.

Example:

  

  
Example  
  
  
  
  
  
  
  
  

Output:

Number of numbers added: 2

Explanation:
In the above example, the Push() method adds the two models to the collection.