I have an array of objects and I'm looking to use google closure. I need to convert some dot notation to bracket notation.
At the moment, I'm accessing properties in a loop like this:
TheArray[i].MyProp1;
TheArray[i].MyProp2;
When I write
TheArray[i].['MyProp1'];
it doesn't convert. How do I do this conversion to bracket notation in arrays of objects.
Drop the dot.
It should just be TheArray[i]['MyProp1'];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With