I'm having some issues with Objects by using them in node js, I need an Object like this:
var clients = {};
var user = {
[client.id] : {
'nome': 'osvaldo',
'sala': 'B1'
}
};
clients.push(user);
But as I'm using the node, I need to get these values dynamically by the index (which is the [client.id]), remembering that the data is dynamically inserted and dynamically consumed, and the way to get a value from that object would be:
user.[client.id].nome
Any idea how to solve this? the client.id is the ID generated by the socket