I have two lists of objects, and I would like to filter mine array1without a key file, which are in array2:
What I've done:
array1 = array1.filter(function(n) {
for(var i=0; i < array2.length; i++){
if(n.file != array2[i].file){
return n;
}
}
});
This returns exactly array1, whereas if I replaced !=with ==, it will return the objects that I want to get rid of.
I do not understand why.
https://jsfiddle.net/hrzzohnL/1/
So in the end I would like to end this array:
[
{
"file": "tttt.csv",
"media": "tttt"
}
]
source
share