Skip to content

Instantly share code, notes, and snippets.

@waghcwb
Created Jan 28, 2020
Embed
What would you like to do?
function diff(arr1, arr2) {
return arr1.filter(x => arr2.includes(x));
}
const arr1 = [
34242,
33030,
34241,
27118,
34152,
33171,
27069,
29001,
8073,
27069,
9658,
9050,
27071,
11037,
11029,
11031,
11032,
13122,
13170,
13168,
13123,
27099,
25563,
26494,
5120,
4752,
15300,
23129,
26947,
26915,
24462,
27035,
24452,
26958,
27068,
27073,
17024,
17023,
5282,
15299,
17012,
10284,
17013,
25729,
17014,
10283,
26912,
33067,
27070,
25755,
23359,
26209,
23361,
23382,
5283,
15301,
25488,
17011,
25754,
27074,
27098,
25737,
25734,
25618,
34178,
25735,
22027,
26612,
24308,
27077,
25560,
27067,
27072,
32002,
32001,
32003,
25617,
21262,
27076,
34117,
26892,
27104
]
const arr2 = [
26982,
14056,
21253,
25118,
21420,
33164,
33165,
34121,
4224,
23129,
33073,
27104,
8086,
26916,
34217,
25169
]
console.log(diff(arr1, arr2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment