javascript - How to get the object property dynamically in the run time using the name of the property -


i have object structured below.

enter image description here

now intention capitals/state value on run time dynamically using property name, example.

var propertyname='capitals'; json.parse(valuelist)[0].propertyname; 

how achieve this. thanks.

you can use bracket notation([]) object selector

var propertyname='capitals'; json.parse(valuelist)[0][propertyname]; 

for more bracket notation : visit here


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -