My question is based on and similar to this one but a little bit different because property name will be variable.
How do I create a function which will return me index of object having certain value of provided property?
function indexOf(propertyName,lookingForValue,array){
//......
return index;
}
So,
indexOf("token",123123,[
{id_list:1, name:'Nick',token:'312312'},{id_list:2,name:'John',token:'123123'}
]);
should return 1.
The main problem I have is how do I check the property value when I have the property name as string with me?