I need to emulate enum type in Javascript and approach seems pretty straight forward:
var MyEnum = {Left = 1; Right = 2; Top = 4; Bottom = 8}
N
In javascript you should be able to combine them as:
var left_right = MyEnum.Left | MyEnum.Right;
Then testing would be exactly as it is in your example of
if ( (left_right & MyEnum.Left) == MyEnum.Left) {...}