It seems to me that the problem is that you’re calling filter on a node list instead of an array. Your node list is an iterable product of querySelectorAll, however it does not contain the filter method as that exclusively belongs to arrays and not node lists.
Potentially you could convert your node list to an array and then call filter, see: