Backbone.js collection.push()

The Backbone.js collection push method is similar to add() method. It adds a model at the end of a collection.

Syntax:


Parameter explanation:

models: It specifies names of the collection instances, which are pushed in the collection.

options:It contains the model types and adds them to the collection instance.

Let's take an example.

See this example:

Test it Now

Output:

Save the above code in push.html file and open this file in a new browser.

BackboneJS Push Collection
Next TopicBackbone.js Pop