Skip to content

Instantly share code, notes, and snippets.

@waghcwb
Created January 28, 2020 16:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waghcwb/60549df9706d99ff15891484b6b26d57 to your computer and use it in GitHub Desktop.
Save waghcwb/60549df9706d99ff15891484b6b26d57 to your computer and use it in GitHub Desktop.
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