title: Display the last item of an array
body: <p>i would like to display only the last item of my array.
  Here is my code :</p>
  
  <p>script.js:</p>
  
  <pre><code>var occurrences = {};
  
  for (i = 0; i &lt; data.tickets.length; i++) {
  
  
          var tag = data.tickets[i].tags[0];
          console.log(tag);
  
          if (occurrences.hasOwnProperty(tag)) {
                     occurrences[tag]++;
                 } else {
                     occurrences[tag] = 1;
                 }
  
  
                 console.log(occurrences["assistance"]);
  
          switch(status){
            case "open":
            break;
            case "closed":
            break;
            case "pending":
            break;
            case "solved":
  
            break;
          }
  
          $("#occurence").append('&lt;p&gt;'+occurrences["assistance"]+'&lt;/p&gt;')
  </code></pre>
  
  <p>But this is what i get when i display occurences["assistance"]:
  I have the list of number and i just want to have the last one (in my case it is the number 22)</p>
  
  <p><a href="https://i.stack.imgur.com/GrB79.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GrB79.png" alt="enter image description here"></a> </p>
  
  <p>and console.log(data.tickets.length) give me that :
  <a href="https://i.stack.imgur.com/5CGws.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5CGws.png" alt="enter image description here"></a></p>