title: Appending JSON Object Number - Troubleshooting
body: <p>How would I go about correctly inputting a number from an array of objects, only once into the html content?</p>
  
  <p>Ideally, I want the object's <code>"category"</code> number to inputted after the last span with in the <code>.viewed</code> class. The end result would then follow something along the lines of..</p>
  
  <p><strong>Joseph Michaels and 3 more people have viewed this post. #4</strong></p>
  
  <p>An example of the JSON file:</p>
  
  <pre><code>{
    "profiles": [
      { "firstName" : "John", "lastName" : "Doe", "gender": "male", "category": 2 },
      { "firstName" : "Jane", "lastName" : "Austen", "gender": "female", "category": 2 },
      { "firstName" : "Alexander", "lastName" : "Beth", "gender": "male", "category": 3 },
      { "firstName" : "Sarah", "lastName" : "Kelly", "gender": "female", "category": 3 },
      { "firstName" : "Rachel", "lastName" : "Haiworth", "gender": "female", "category": 3 },
      { "firstName" : "Thomas", "lastName" : "Alfae", "gender": "male", "category": 3 },
      { "firstName" : "Roy", "lastName" : "Harper", "gender": "male", "category": 4 },
      { "firstName" : "Joseph", "lastName" : "Michaels", "gender": "male", "category": 4 },
      { "firstName" : "William", "lastName" : "Lee", "gender": "male", "category": 4 }
    ]
  }
  </code></pre>
  
  <p>A portion of the JS file:</p>
  
  <pre><code>if (obj.category == 4) {
      $('.contentBox:nth-child(4) .viewed').append('&lt;span class="user"&gt;' + obj.firstName + ' ' + obj.lastName + '&lt;/span&gt;' + ' ');
      $('.contentBox:nth-child(4) .viewed span:last-child').append('&lt;span class="categoryNumber"&gt;' + obj.category + '&lt;/span&gt;');
  
      //$('.contentBox:nth-child(4) .viewed').append('&lt;span class="categoryNumber"&gt;' + obj.category + '&lt;/span&gt;');
  }
  </code></pre>
  
  <p>Currently the code is inputting <code>&lt;span class="categoryNumber"&gt;&lt;/span&gt;</code> multiple times into the one line. Therefore, the category number is displaying multiples times.</p>
  
  <p>What is the best solution for this situation?</p>
  
  <p>View the current <a href="http://plnkr.co/edit/DQcWLBBDegi1N02Aaxeh?p=preview" rel="nofollow">Plunker</a>.</p>