title: JavaScript enumerator?
body: <p>I want to define a list of constants that have continuous integer value, for example:  </p>
  
  <pre><code>var config.type = {"RED": 0, "BLUE" : 1, "YELLO" : 2};  
  </code></pre>
  
  <p>But it's boring to add a <code>"XX" : y</code> every time I need to add a new element in it.<br>
  So I'm wondering is there something like <code>enumerator</code> in C so I can just write:<br>
  <code>var config.type = {"RED", "BLUE", "YELLO"}</code> and they are given unique integer value automatically.</p>