Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • a.a is getting property a of object a. a[a] is trying to get an array element. Commented Jul 12, 2013 at 9:49
  • @Archer Thanks, but how I get the property a dynamically? Commented Jul 12, 2013 at 9:50
  • 1
    @Archer - No. The former is getting the property a the latter is getting the property with the name that is the same as the string value of a. It has nothing to do with arrays. Commented Jul 12, 2013 at 9:51
  • The accepted answer in the following question has a good explanation: stackoverflow.com/questions/17189642/… Commented Jul 12, 2013 at 9:51
  • If your keys are a numeric sequence, then you should be using an array ({ product: [val, val, val] }) and a for i=1; i<array.length; i++ loop. Commented Jul 12, 2013 at 9:54