I've a JavaScript Array like
var main = [
{ "title": "Yes", "path": "images/main_buttons/tick_yes.png"},
{ "title": "No", "path": "images/main_buttons/cross_no.png"},
]
I want to get the corresponding path value for the item which have a particular title value.
Something like
var temp = "Yes";
var result = (path value where main[0].title == temp);
I want to get the result value here.
If temp == "No", it should get me the corresponding path value.
mainand compare each elements.titlevalue until you found the right one.var arr = ["yes":"someval","no","someotherval"]and access them witharr["yes"]