Backbone.JS Where()

The Backbone.JS Where() collection method is used to display the model by using the matched attribute in the collection.

Syntax:

Collection.Where ( attribute )   

Parameters:
attribute: This parameter is used to specify the attribute of a model in a collection.

Example:

  

  
Example  
  
  
  
  
  
  
  
  

Output:

Total matched name attribute:2

Explanation:
In the above example, the Where() method returns the number of matched value for the “name” attributes of the models in a collection.