Reputation: 404
In my object
obj.resposta1
obj.resposta2
obj.resposta3
obj.resposta4
how access the values of each inside a
for ( var int = 1; int < 5; int++)
?
Thanks, Celso
Upvotes: 1
Views: 119
Reputation: 45589
Try this:
for ( var int = 1; int < 5; int++){
obj['resposta'+int];
}
Upvotes: 1
Reputation: 223023
var i;
for (i = 1; i < 5; ++i) {
alert(obj['resposta' + i]);
}
Upvotes: 6