title: Filter array with JavaScript or jQuery
body: <p>I would like to filter the array below and remove any of the objects where <strong>type</strong> is equal to a defined variable of the same name and is false.</p>
  
  <p>In the example below, the element containing type:second should be removed from the array.</p>
  
  <pre><code>var first = true,
    second = false,
    third = true,
    obj = {"data": [
      {"type":"first","message":"This is the first message"},
      {"type":"second","message":"This is the second message."},
      {"type":"third","message":"This is the third message."}
  ]};
  
  data = obj.data;
  
  var filtered = $.grep(data, function(v) {
      return ....
  });
  
  console.log(filtered);
  </code></pre>
  
  <p><a href="http://jsfiddle.net/ejPV4/642/" rel="nofollow">http://jsfiddle.net/ejPV4/642/</a></p>