Backbone.JS FindWhere() collection

The Backbone.JS FindWhere() collection method is used to get the first model that matches the specified attribute in the collection.

Syntax:

Collection.FindWhere ( attribute )

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

Example:

  

  
Example  
  
  
  
  
  
  
  
  

Output:

The values of matched attribute are: {"name":"Happy","id":10}

Explanation:
In the above example, the FindWhere() method returns the first matched model for the “id: 10” in the collection.