The Backbone.JS Add() collection method adds a model or array of models to a collection.
Syntax:
Backbone.Collection.Add ( models, options )
Parameters: models: This parameter is used to specify the models to be added to the collection. options: This parameter is used to specify the model types.
Example:
Example
Output:
Number of added numbers : 2
Explanation: In the above example, the Add() method adds two models to an already existing collection.
Please follow and like us: