I am trying to push new values to an array, but when the values are pushed 2 new arrays are created. I am trying to push the values into one array not in separate ones. How do I do that? Here is the code I am using.
for (count = 0; count < xmlItem.length; count++) {
// dates
xmlDate = new Date(xmlItem[count].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue);
// titles
xmlTitle = xmlItem[count].getElementsByTagName("title")[0].childNodes[0].nodeValue;
// descriptions
xmlDescription = xmlItem[count].getElementsByTagName("description")[0].childNodes[0].nodeValue;
// date reformated
pubDate = (xmlDate.getMonth() + 1) + "/" + xmlDate.getDate() + "/" + xmlDate.getFullYear();
// if there is a new code
if (pubDate == today) {
// array with titles for new values
totalValues = new Array();
// add the title
totalValues.push(xmlTitle);
// add badge for number of values
chrome.browserAction.setBadgeText({ text: JSON.stringify(totalValues.length) });
}
}