I am trying to find the best way to iterate over all the values ββin an enumeration defined in Google Closure. Let's say I have the following enumeration defined:
sample.namespace.Fruit = { Orange: 0, Apple: 1, Banana: 2 };
Right now, the best way I've seen for this would be something like this:
for (var key in sample.namespace.Fruit) { var fruit = (sample.namespace.Fruit[key]);
I find it painful to read. I list the namespace three times to get the compiler to go on a trip. Is there any other iteration method that I should use instead? Is this the best way to do this form of iteration?
source share