Following is an example of js object:
var arr =
{
"a1": { "0.25": 13, "0.5": 50},
"a2": { "0.5": 50, "0.75": 113, "1": 202}
}
id = 'a1';
key = "0.25";
function myFunc(id, key) {
return arr[id][key];
}
Using the above function I can get the value of the corresponding key.
My question how can I get the Key for a given value?
E.g. if id = 'a2' and value = 113, the function should return the corresponding key 0.75