I need to create an object array in javascript with this structure:
var nodes = {
'0': { 'label': 'abc' },
'1': { 'label': 'cdf' },
'2': { 'label': 'kjh' },
'3': { 'label': 'wef' },
'4': { 'label': 'vrg' }
};
I have tried like this but with no success :(
var nodes = {};
for (var i = 0; i < 4; i++) {
nodes[i] = { i: { 'label': 'xpto'+i } };
}
Any ideas?
Thanks in advance!