Storing function arguments in a specific 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] + ', '
}
}
It assigns the days and total values spent on each day while looping. 2015-07-05:
"2015-07-05: "undefined59, 62, 65...
2015-07-06: "undefined61, 61, 60..."
Each parameter starting with "undefined". How can I prevent this?