Logo

Programming-Idioms

History of Idiom 218 > diff from v19 to v20

Edit summary for version 20 by Vaporox:
New JS implementation by user [Vaporox]

Version 19

2020-07-18, 23:31:27

Version 20

2020-08-10, 12:37:11

Idiom #218 List intersection

Create list c containing all unique elements that are contained in both lists a and b.
c should not contain any duplicates, even if a and b do.
The order of c doesn't matter.

Idiom #218 List intersection

Create list c containing all unique elements that are contained in both lists a and b.
c should not contain any duplicates, even if a and b do.
The order of c doesn't matter.

Extra Keywords
intersect and conjunction
Extra Keywords
intersect and conjunction
Code
const c = [...new Set(a)].filter(e => b.includes(e));