Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to pass array element name?
Message
De
30/11/2015 11:08:27
 
 
Information générale
Forum:
Javascript
Catégorie:
Autre
Divers
Thread ID:
01628031
Message ID:
01628078
Vues:
31
>>comments can be misleading: untested
>>
>>function MyTest( cCol1Name ) {
>>var MyObject = .... object is created
>>var Row = MyObject[0].cCol1Name;
>>var Col1Val = Row[cCol1Name]
>>// var Col1Val = eval( "Row." + cCol1Name)
>>}
>>>>>
>
>Thank you.

The commented eval() should work as well, but is considered by some to be an anti-pattern. Was a bit short in my explanation ;-)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform