I am working on a chat and using an array to hold the users. Here is my problem:
User1 joins and is given Index 0 in the array via push. User2 joins and is given Index 1 in the array via push.
User1 disconnects and is removed via splice.
NOW User2 becomes Index 0.
User1 reconnects and is given Index 1 via push.
User2 disconnects, and Index 1 is removed which is now User1.
This is of course causing a problem.
So my question is how can I remove the item from the array without the index of the other elements changing? Am I on the wrong track here?