i would like to display only the last item of my array. Here is my code :
script.js:
var occurrences = {};
for (i = 0; i < 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('<p>'+occurrences["assistance"]+'</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)