From 13553d82c4746db09ce801421f0e9a5efcc300bb Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 24 Jun 2020 18:28:34 -0700 Subject: [PATCH] game: Fix to actually drop connections that get closed The bug here is that filter() returns a new array, so I have to assign the return value to the original reference for this code to have any effect. --- game.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game.js b/game.js index 5a49b6b..4649b56 100644 --- a/game.js +++ b/game.js @@ -23,7 +23,7 @@ class Player { /* Returns the number of remaining connections after this one is removed. */ remove_connection(connection) { - this.connections.filter(c => c !== connection); + this.connections = this.connections.filter(c => c !== connection); return this.connections.length; } -- 2.43.0