Reputation: 1311
If I have an object with items named and ending in sequential numbers:
var theobject = { item1:, item2:, item3:, ...etc }
this method of extracting the objects and used in a for loop does not seem to work. Should this work provided the rest of the function is correct?
theobject.item+i
Upvotes: 0
Views: 36
Reputation: 1736
You can do something like theobject['item'+i]
.
But you can do something better using jquery foreach so that you can iterate over keys.
Upvotes: 2