VOOZH about

URL: https://www.geeksforgeeks.org/javascript/backbone-js-pluck-collection/

⇱ Backbone.js pluck Collection - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Backbone.js pluck Collection

Last Updated : 26 Jul, 2022

The Backbone.js pluck Collection is used to Pluck an attribute from each model in the collection. This method is equivalent to the map function and returns a single attribute value from each model. This method takes the attribute name as a parameter that has to get from the model. 

Syntax: 

collection.pluck( attr );

Parameter: 

  • attr: It is the attribute name of the model which has to retrieve from the model.

Example 1: In this example, we will illustrate the Backbone.js pluck Collection. Here we will pluck the title attribute of each Model.

Output:

👁 Image
Backbone.js pluck Collection

Example 2: In this example, we will pluck all the attributes of the Model and see the value of the attributes.

Output:

👁 Image
Backbone.js pluck Collection

Reference: https://backbonejs.org/#Collection-pluck

Comment