title: Filter items in JavaScript Array using jQuery
body: <p>I have a JavaScript array as below which I need to filter to get the correct child values from the test data below. </p>
  
  <pre><code>var arrChildOptions2 = [
          {Parent:'opt1',Value:'opt1',Text:'Parent1 - Child 1'}, 
          {Parent:'opt2',Value:'opt1',Text:'Parent 2 - Child 1'},
          {Parent:'opt2',Value:'opt2',Text:'Parent 2 - Child 2'}
      ];
  </code></pre>
  
  <p>The values are used to populate a dropdown based on the change event of a parent dropdown as below.</p>
  
  <pre><code>$(function() {
      $('#ddl1').change(function() {
          $('#ddl2 option:gt(0)').remove();
          $('#ddl2').addItems('#ddl2', arrChildOptions2[Parent=opt2]);
      });
  });
  </code></pre>
  
  <p>where additems is a function that loops through the array. Problem is I can't get it to filter by parent, I've tried using <strong>contains</strong> and the above <strong>arrChildOptions2[Parent=opt2]</strong> but I can't get it to filter, I'd prefer to find a neat solution rather than use a for loop? Any ideas, cheers</p>