Backbone.JS Reset() collection

The Backbone.JS Reset() collection method is used to reset a collection and populate it with a new array of models or empty the entire collection.

Syntax:

Backbone.Collection.Reset ( models, options )   

Parameters:
models: This parameter is used to specify the models to reset.
options: This parameter is used to contain the NULL values.

Example:

  

  
Example  
  
  
  
  
  
  
  
  

Output:

Number of added numbers : 2
Number of remaining numbers : 0

Explanation:
In the above example, the Reset() method empties the collection.