I have the following javascript variable:
var myList =
{
itemA: 0,
itemB: 1,
itemC: 2,
itemD: 3,
itemE: 4
};
I have the value of the variable, ie 0, 1, 2 etc and need to find the corresponding key to it ie if I have 2, the key would be itemC.
How can I do this with javascript?
You can try this:
http://jsfiddle.net/shaneburgess/7DzUM/