![]() |
VOOZH | about |
The intersectByKeys() method is used to remove any given keys from the original collection that are not present in the given array or collection.
Syntax:
collection.intersectByKeys(key)
Parameters: This method accepts single parameter as mentioned above and described below:
Return Value: This method returns the intersected collection items.
Below example illustrate the intersectByKeys() method in collect.js:
Example 1:
Output:
{ name: 'Rahul', section: 'A' }
Example 2:
Output:
{ key11: 'val1', key13: 'val3' }