0
Remove a specific item from a 2d array without .filter()
Say I have an 2 dimensional array like this: array = [ [1,2,3,4,5,true], [2,3,4,5,6,false], [3,4,5,6,7,true], [4,5,6,7,8,false] ] where true = is the last number a prime How do I remove all 'false' elements like this For(let i in array) If(array[i][5]) //remove array[i][4] The .filter could be used here, but I am using a library that also hasa filter function inside it, so it won't let me use it. Is there a way to maybe array.splice(i[4], 1); but in another way because this one also didn't work Weird enough removing the whole subarray didn't work out for me too ( array.splice(i,1); )
2 Answers
+ 2
you have the wrong syntax)
it will be right:
array[i].splice(4,1);
+ 1
I'm so dumbšš
thanks anyways