I have a dynamically generated multidimensional array from which I want to remove a specific value.
I have this code, so far:
mainARR = [[1,2,3,4], [5,6,7,8]];
delARR = [1,2,3,4];
function removeByValue(array, value){
return array.filter(function(elem, _index){
return value != elem;
});
}
mainARR = removeByValue(mainARR, delARR);
console.log(JSON.stringify(mainARR));
I don't know the index of the value I want to remove. Instead, I know the actual value. The code does not work when the value is an array. It works perfectly for simple arrays like [1,2,3,4] when I want to remove, let's say, the value 1.
Any help is appreciated.