title: Display last four JSON objects only
body: <p>Currently I have two HTML sections, 'standard' and 'featured'. My jQuery code splits the JSON objects into the two categories and displays them within the designated section, dependant on whether they are 'featured' or not. Currently however, every object with the value 'featured' is being displayed. How do I change this so that only the last four JSON objects with the value 'featured' are displayed within the section?</p>
  
  <p>I'm guessing it's as simple as adding an <code>if</code> statement, however my attempts so far have not gone well.</p>
  
  <p>JSON is as follows:</p>
  
  <pre><code>{"blog":[
   {
      "title":"This is the title",
      "content":"And this is the content",
      "date":"01/12/11",
      "featured":"Yes"
   },
   {
      "title":"This is another title",
      "content":"And this is some more content",
      "date": "01/01/12",
      "featured":"No"
   },
   {
      // Continuation
   }
  ]}
  </code></pre>
  
  <p>Current jQuery is:</p>
  
  <pre><code>$.getJSON("/TEST/readdb.php", function(json){
      if(json.blogs.length &gt; 0) {
          $.each(json.blogs, function(){
              var info = '&lt;h2&gt;' + this['title'] + '&lt;/h2&gt;&lt;p&gt;' + this['content'] + '&lt;/p&gt;&lt;p id="date"&gt;' + this['date'] + '&lt;/p&gt;';
              if(this['featured'] == "Yes") {
                  $('#featured').append(info);
              }
              else {$('#standard').append(info);
              }
          });
      }
  });
  </code></pre>