This version is old school.
Please find jQuery plugins on npm.
jQuery Array Utilities
Use the set operations UNION, INTERSECT, EXCEPT, known from SQL, to extract data from arrays. DISTINCT is also available to extract an array with distinct values. This plugin has been heavily tested. There are several automated tests for each method in this plugin.