title: How to iterate over a nested object array in Javascript
body: <p>How can I iterate through a nested array of objects in Javascipt? I have an object named <code>obj</code>. I want to retrieve the object where <code>in</code> is <code>credit</code> and <code>out</code> is <code>bank</code>.</p>
  
  <pre><code>// I have tried using filter but returns empty array
  const s = obj.filter(function(t){
    return t.in == "credit" &amp;&amp; t.out == "bank";
  })
  console.log(s);
  </code></pre>
  
  <p>This is the data:</p>
  
  <pre class="lang-js prettyprint-override"><code>var obj = [{
    "btob": [{
      "id": "trans",
      "in": "bank",
      "out": "bank",
      "value": 10
    }],
    "ctob": [{
      "id": "trans",
      "in": "credit",
      "out": "bank",
      "value": 20
    }],
    "dtob": [{
      "id": "trans",
      "in": "debit",
      "out": "bank",
      "value": 30
    }]
  }, {
    "btob": [{
      "id": "fund",
      "in": "bank",
      "out": "bank",
      "value": 10
    }],
    "ctob": [{
      "id": "fund",
      "in": "credit",
      "out": "bank",
      "value": 10
    }],
    "dtob": [{
      "id": "fund",
      "in": "debit",
      "out": "bank",
      "value": 30
    }]
  }]
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>  [{
      "id": "trans",
      "in": "credit",
      "out": "bank",
      "value": 20
    },
    {
      "id": "fund",
      "in": "credit",
      "out": "bank",
      "value": 10
    }]
  </code></pre>