diff --git a/core/misc/autocomplete.js b/core/misc/autocomplete.js
index d4938fccdd9551939acee39169730530c02317ab..1d141b564647cebbc614a886517bca103ee2fc87 100644
--- a/core/misc/autocomplete.js
+++ b/core/misc/autocomplete.js
@@ -110,13 +110,10 @@
      */
     function showSuggestions(suggestions) {
       const tagged = autocomplete.splitValues(request.term);
-      const il = tagged.length;
-      for (let i = 0; i < il; i++) {
-        if (suggestions.includes(tagged[i])) {
-          suggestions.splice(suggestions.indexOf(tagged[i]), 1);
-        }
-      }
-      response(suggestions);
+      const filteredSuggestions = suggestions.filter(
+        (el) => !tagged.includes(el.value),
+      );
+      response(filteredSuggestions);
     }
 
     // Get the desired term and construct the autocomplete URL for it.