title: filter by property in child array using underscore.js
body: <p>I have an array like the following:</p>
  
  <pre><code>var result=[{"id": 1, "details": [{"ah": 1.0, "dId": 11},{"ah": 2.0, "dId": 11}, {"ah": 2.0, "dId": 12}]}, {"id": 2, "details": [{"ah": 1.0, "dId": 11},{"ah": 2.0, "dId": 11}]}]
  </code></pre>
  
  <p>Now I would like to filter it by the Id and dId-properties using underscore.js, eg. giving me all details for id=1 and dId=11 and doing a sum of the ah-properties. So eg. filtering for id=1 and dId=11 should return 3.</p>
  
  <p>I tried something like this: <code>_.where(result, {id: 1, details.dId:11})</code></p>
  
  <p>But I couldn't get it to work.</p>
  
  <p>I created a fiddle:
  <a href="http://jsfiddle.net/j9Htk/" rel="nofollow">http://jsfiddle.net/j9Htk/</a></p>
  
  <p>Any help is appreciated</p>
  
  <p>thanks</p>
  
  <p>Thomas</p>