Backbone.JS Shift()

The Backbone.JS Shift() collection method removes the first item from the collection.

Syntax:

Collection.Shift ( options )   

Parameters: options: This parameter is used to specify the model types.

Example:

  

  
Example  
  
  
  
  
  
  
  
  

Output:

Original array:[{"id":100,"name":"Jim","age":11},{"id":200,"name":"Tim","age":9}]
After Shift:[{"id":200,"name":"Tim","age":9}]

Explanation: In the above example, the Shift() method removes the model Student1 from the collection.

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