-3

I have custom_comissionData.ProviderID_{parent.customData.serviceLogo}.fix

where parent.customData.serviceLogo is another variable, which value I want to put here as part of variable name.

I mean parent.customData.serviceLogo= 1000

and I want to get value of

custom_comissionData.ProviderID_1000.fix

but the way I typed it causes "Uncaught SyntaxError: missing ) after argument list"

Any way to fix this problem ?

David
  • 4,332
  • 13
  • 54
  • 93

1 Answers1

1

These are equivalent in JavaScript:

object.property
object['property']

You may access your item using the second approach:

custom_comissionData['ProviderID_' + parent.customData.serviceLogo].fix
Yeldar Kurmangaliyev
  • 33,467
  • 12
  • 59
  • 101