The below function returns this output. But I can't understand why. Any clues?
Output: {"A":{"antal":null},"B":{"antal":null},"C":{"antal":null},"D":{"antal":null},"E":{"antal":null},"G":{"antal":null}}
Function is,
function seriestat(){
var statserier = {};
$.each(globalSIEdata["#EXTRA"]["VERSERIER"], function(i, item) {
statserier[i] = {};
});
$.each(globalSIEdata["#VER"], function(i2, item2) {
var serie = i2.substring(0, i2.indexOf('-'));
statserier[serie]["antal"] += 1;
});
return statserier;
}
Here is example from globalSIEdata:
{ "#VER": {
"A-1": {
"verdatum": "2017-01-03"
},
"A-2": {
"verdatum": "2017-01-03"
},
"B-1": {
"verdatum": "2017-01-03"
},
"B-2": {
"verdatum": "2017-01-03"
}
"A-3": {
"verdatum": "2017-01-03"
}
}
globalSIEdatalooks like? can you share some sample/minimal data for review/testing?statserier[serie]["antal"] += 1?nullsomewhere else, there's no way += 1 would ever get younull