I hear a lot about how we should use arrays for things like users list, as it's fast and there are functionalities like length that can be useful etc.
However in many of my use cases, I feel like an object of objects is the way to go and I'd like your opinion. For example, there's a list of users on my real-time app -- the list has to be updated whenever a new user connects or disconnects. Would you use an array or an obj like this in this case? If you use an array, what are the reasons?
var obj = {
"1": {id:1, fullName: 'My Name', sex: 'male'},
"50": {id:50, fullName: 'My Name', sex: 'none'},
"5": {id:5, fullName: 'My Name', sex: 'female'},
};
When a user joins I just add his obj to the obj, and when a user discs, I just use delete obj[50];
If I used an array, I'd have a removeUser(id) function which scans the array and removes the user when it finds it.