I am trying to remove a piece of a data from a JSON array. For example, I have this array;
var users = [];
io.on('connection',function(socket){
socket.on('nickname', function(nick){
socket.nick = nick;
users.push({
user:socket.nick,
userid:socket.id,
socket:socket
});
});
I am trying to delete in users this way;
socket.on('disconnect', function(){
delete users[{
user,
userid,
socket
}];
});
});
How can I do that?