intersection
Modified on Fri, 18 Aug 2023
Description
Return the new array of intersecting values.
Syntax
intersection(array1, array2, arrayN)
Parameters
Input Parameter | Type | Description |
---|---|---|
array1 | Array | array to inspect |
array2 | Array | array to inspect |
arrayN (optional) | Array | array to inspect |
Return value
Type |
---|
Array<any> |
Sample
Example | Result | Description |
---|---|---|
intersection([1, 2, 3], [2, 3, 4]) | [2, 3] | Return common values in 2 arrays |
intersection([1, 2, 3], [2, 3, 4], [3, 4, 5]) | [3] | Return common values in 3 arrays |
intersection([1, 2], [2, 3], [2, 1], [3, 2]) | [2] | Return common values in 4 arrays |
To view all the List functions, click here.
See Also
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article