Returns the intersection of two arrays: the elements that are in common. Duplicates are removed in the process.
Custom function checks equality of objects:
// Compare based on 'name' property
intersection(arrayA, arrayB, (a,b) => {
return a.name === b.name
})
Returns the intersection of two arrays: the elements that are in common. Duplicates are removed in the process.
Custom function makes a string representation of objects to use as the basis for comparison
intersection(arrayA, arrayB, (v) => v.name)
Returns the intersection of two arrays: the elements that are in common. Duplicates are removed in the process.
Custom function checks equality of objects:
// Compare based on 'name' property
intersection(arrayA, arrayB, (a,b) => {
return a.name === b.name
})
Returns the intersection of two arrays: the elements that are in common. Duplicates are removed in the process.
By default compares based on a string representation of object.
To compare object instances:
To use a custom string representation, eg, to only compare based on 'name' property of objects:
See also:
Param: arrayA
Param: arrayB
Param: comparerOrKey
Comparer or key-generating function
Returns