I do have a javscript object containing a product name and the corresponding product code. The code is unique.
var products = {
"Pineapple":38,
"Apple":110,
"Pear":109
};
If i want to know the code for a product i can just do
var pineapplecode = products["Pineapple"];
How do I check if there is a product for a given number and if print it ? Or do I have to/should I change the way the data is saved ?