Javatpoint Logo
Javatpoint Logo

Backbone.js collection.set()

The backbone.js collection set method performs a smart update of the collection with a set of items in the model. If a model in the list isn't yet in the collection it will be added; if the model is already in the collection its attributes will be merged.

Syntax:


Parameter explanation:

models: It specifies an instance of the collection along with values to be set in the collection.

options: It contains parameters such as id, name etc. to set the values in the collection.

Let's take an example.

See this example:

Test it Now

Output:

Save the above code in set.html file and open this file in a new browser.

BackboneJS Set Collection
Next TopicBackbone.js Get





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA