So I have an array with 7 values:
var names = ["Tom", "James", "Matthew", "Jordy", "Jeremy", "Jasper", "Jordy"]
I need to get rid of both "Jordy", not just one, but both of them.
I'm using plain JS and a bit of jQuery. I know I can filter out one of them, but I don't know how to do both.
the result would have to be:
var names = ["Tom", "James", "Matthew", "Jeremy", "Jasper"]
forloop from the end of the array to the front so when you remove an element, it won't affect the indexing for the elements you haven't yet seen. And, please paste in the code you tried (into your question using the edit link) and describe what problem you ran into. That's how StackOverflow works best. You may also find the array method.filter()to be easiest if you don't mind the result being in a new array.