title: Javascript enum within an enum
body: <p>I have the following "Enum" in javascript to indicate the state of my application:</p>
  
  <pre><code>var State = {
     STATE_A: 0,
     STATE_B: 1,
     STATE_C: 2
     //...
  }
  </code></pre>
  
  <p>Now, I want each state to have a "sub-state".  So for example, <code>STATE_B</code> could be in <code>STATE_B1</code> or <code>STATE_B2</code> ...</p>
  
  <p>What would be the best way to structure this? Would I somehow nest an "enum" within the <code>State</code> "enum" ?  Thanks</p>
  
  <p>If there is a better way to structure this altogether (other than enums) I'm all ears.  Basically I need to be able to set and check the state of my application, and each state can (but not necessary) have a sub-state attached to it which can be set and checked.  Even better if the solution allows me to go more than 1 level of nesting deep.</p>