1
I need to create an array or object, but with dynamic name/index, like this of the example, but the name must come from a variable:
var1 = "testeIndex";
var obj = {
var1 : {
'elemento1' : 'dado1',
'elemento2' : 'dado2'
},
var2 : {
'elemento1' : 'dado1',
'elemento2' : 'dado2'
},
var3 : {
'elemento1' : 'dado1',
'elemento2' : 'dado2'
},
};
However, when I put the variable name, even without quotation marks, the index takes the literal name of the variable.
It’s possible to do what I’m trying to do?
It would be legal to enter compatibility information, such as the session Browser Compatibility MSN (is the line Computed Property Names)
– fernandosavio
It worked, thank you!
– Otávio Silveira