Condition to check if variables exist in an array of objects
<p>I have an array named <code>data</code> as shown below and an array of objects named <code>obj1</code>. </p>

<pre><code>var data = ["004", "456", "333", "555"];


obj1 = [{
  id: "004",
  name: "Rick",
  Active: "false"
  }, {
    id: "005",
    name: 'david',
    Active: "false"
}];
</code></pre>

<p>I check if elements of array <code>data</code> are present in the <code>obj1</code>. This is the code for that. It will give that <code>"004"</code> as the answer as <code>004</code> is present in the <code>obj1</code>.</p>

<pre><code>out = [];

_.each(arr, function(value1, key1, obj1) {
   _.each(data, function(value, key, obj) {
        if (value1.id == value) out.push(value);
   });
});

console.log(out);
</code></pre>

<p>Now i want the following to be added too</p>

<pre><code>var Activecheck = false;
</code></pre>

<p>I want to check if elements of arrray <code>data</code> is present in <code>obj1</code> where the <code>obj1.Active</code> field is equal to false. Any way to add this variable into my code where I can check this condition?</p>