The Backbone.JS Unshift() collection method adds a specified model at the beginning of a collection.
Syntax:
Collection.Unshift ( models, options )
Parameters:
models: This parameter is used to specify the models to be added to the beginning of the collection.
options: This parameter is used to specify the model types.
Example:
Example
Output:
[{"id":200,"name":"Tim","age":9},{"id":100,"name":"Jim","age":11}]
Explanation:
In the above example, the Unshift() method adds the Student2 model to the beginning of the collection