This is probably a no-brainer, but how can I make this happen:
var name = otherObject.name; //"string"
var o = {
name : otherObject
};
alert(o["string"].name);
Thanks in advance!
This is probably a no-brainer, but how can I make this happen:
var name = otherObject.name; //"string"
var o = {
name : otherObject
};
alert(o["string"].name);
Thanks in advance!
Use array notation instead.
var name = otherObject.name;
var o = {};
o[name] = otherObject;