160
rated 0 times
[
162]
[
2]
/ answers: 1 / hits: 16418
/ 13 Years ago, tue, june 14, 2011, 12:00:00
I want to define a list of constants that have continuous integer value, for example:
var config.type = {RED: 0, BLUE : 1, YELLO : 2};
But it's boring to add a XX : y
every time I need to add a new element in it.
So I'm wondering is there something like enumerator
in C so I can just write:
var config.type = {RED, BLUE, YELLO}
and they are given unique integer value automatically.
More From » javascript