My docs say Array has 'slice', not 'splice'.
That being said, I would expect you to have better luck using
Array.filter, takes a callback function and an optional 'this'
parameter and returns an array with all elements for which the
callback return is not false.
On 1/11/22, Erik Burggraaf <burggraaferik@xxxxxxxxx> wrote:
Hi all, I just tried to remove items from an array of html elements using
splice() and got this error that array.splice is not a function. Any idea
why? I've read four or five articles but nothing illuminating.
My situation is that I wanted to get elements by tag name so that I didn't
have to use a custom class. So I swept the elements into an array and they
work just fine. Unfortunately, there were more of the same, in this case
articles in my production environment than there are in my test
environment. I don't need the extra ones, so thought splice would be an
easy way to pull them out.
I looped through the array, testing a condition. If they meet the
condition they get pulled out. Otherwise they stay.
But the splice method is not a function or so I'm told by my error console.
Any suggestions very much appreciated as always.
Thanks,
Erik