Backbone.JS At()

The Backbone.JS At() collection method retrieves a model from a collection by using a specified index.

Syntax:

index()    

Parameters: index: This parameter is used to specify the index position for the retrieval of the model from a collection.

Example:

  

  
Example  
  
  
  
  
  
  
  
  

Output:

Old Students List: [{"id":1,"name":"Tom"},{"id":2,"name":"Jerry"}]
New Students List: [{"id":1,"name":"Tom"},{"id":2,"name":"Jerry"},{"id":3,"name":"Bruno"}]

Explanation: In the above example, the model ‘Student3’ is added at 2nd index of the collection.

Please follow and like us:
Content Protection by DMCA.com