Example -
var users = {
};
var conn = "ajey";
var ajey = {
name: 'ajey',
age: 25
}
users.conn = ajey;
This returns
[object Object] {
conn: [object Object] {
age: 25,
name: "ajey"
}
}
As you notice the object key is "conn" but how do I make it substitute the value of conn
which is "ajey" ??
NOTE - I am not trying to access the object key. I am trying to set the object key with the value of a variable