Basic JavaScript: Using Objects for Lookups js code example
Example: basic javascript using objects for lookups
var alpha = {
1:"Z",
2:"Y",
3:"X",
4:"W",
24:"C",
25:"B",
26:"A"
};
alpha[2]; // "Y"
alpha[24]; // "C"
var value = 2;
alpha[value]; // "Y"