In Javascript, I have an object:
obj = { one: "foo", two: "bar" };
Now, I want do do this
var a = 'two';
if(confirm('Do you want One'))
{
a = 'one';
}
alert(obj.a);
But of course it doesn't work. What would be the correct way of referencing this object dynamically?