I have an enum:
var a = {X: 0, Y: 1};
And, I want to create another enum from the values of the first one. Something like this:
var b = {a.X: foo, a.Y: bar};
Doing this gives me a SyntaxError: Unexpected token .
Is there a way I can use the values of one enum as the key to another in javascript?
FYI: I realize I can do something like this to achieve what I want
var b = {};
b[a.X] = foo;
b[a.Y] = bar;
But, from a readability perspective, I would prefer if there was some way to do it the former way.