130
rated 0 times
[
132]
[
2]
/ answers: 1 / hits: 15338
/ 6 Years ago, fri, april 6, 2018, 12:00:00
How is this working? I am having a hard time understand this.
const arr1 = [{id:1,name:jhon},{id:2,name:max},{id:3,name:fer}];
const arr2 = [8, 9];
var diffArray = arr2.filter(x => !arr1.filter(y => y.id === x).length);
console.log(diffArray);
More From » javascript