I have some object with name and variables.
var data = [ { "id": 144,
"name": "Zagreb",
"region": "",
"iso": "HR",
"country": "Croatia"},
{ "id": 145,
"name": "Wellington",
"region": "",
"iso": "NZ",
"country": "New Zealand"}];
For render dropdown I need only "name" and "country".
But, object can have other names with variables. Which I know. So I have idea, write names that needs to render in array like.
var renderNames = ['name', 'country'];
At this moment i've stopped. I don't know how to get value from object using names from array. As I see, it's must be something like that:
data.name == data. (do something) renderNames[1];