I hope the day finds you well.
So I have an object with no properties. I'm trying to add multiple properties to this object using a loop. Each property added to the loop will appear in the object multiple times depending on how many times the loop runs, with each new property incremented by 1.
So I have something like this:
myObject = { };
for(i = 0; i < 2; i++){
myObject.propA + i = foo;
myObject.propB + i = bar;
};
Which I want to yield something like this:
myObject.propA0 = foo;
myObject.propB0 = bar;
myObject.propA1 = foo;
myObject.propB2 = bar;
Giving a nice stack of objects generated on the fly depending on how many times the loop runs. But I don't seem to be getting this. So how exactly do I feed the variable from the loop to the property when it's created and assigned?