title: Enum flags in JavaScript
body: <p>I need to emulate enum type in Javascript and approach seems pretty straight forward:</p>
  
  <pre><code>var MyEnum = {Left = 1; Right = 2; Top = 4; Bottom = 8}
  </code></pre>
  
  <p>Now, in C# I could combine those values like this:</p>
  
  <pre><code>MyEnum left_right = MyEnum.Left | MyEnum.Right
  </code></pre>
  
  <p>and then I can test if enum has certain value:</p>
  
  <pre><code>if (left_right &amp; MyEnum.Left == MyEnum.Left) {...}
  </code></pre>
  
  <p>Can I do something like that in Javascript?</p>