Function argument is stored in such format
["2015-07-05 00:30", 59]
...
["2015-07-05 01:00", 62]
function generateCSV(timeAndValue) {
object = {}
var zero = 0;
for(i = 0; i < timeAndValue.length; i++){
var value = timeAndValue[i]
var days = moment(value[0]).format('YYYY-MM-DD');
obj[days] += value[1] + ', '
}
}
In the loop object takes days as parameter and the amount of value spent on that day. 2015-07-05:
"2015-07-05: "undefined59, 62, 65...
2015-07-06: "undefined61, 61, 60..."
Every parameter value is beginning with "undefined". How can I loop that parameters wouldn't begin with "undefined"?