javascript:arrays:array_diff
This is an old revision of the document!
JavaScript - Arrays - Array Diff
var difference = function(compare){ return Array.from(arguments).reduce(function(previous, current){ return previous.filter(function(element){ return current.indexOf(element) == -1; }); }); };
NOTE: You can also use a reusable component called array-diff:
diff([1,2,3], [1,2,3,4,5]) // => [4,5]
javascript/arrays/array_diff.1589974051.txt.gz · Last modified: 2020/07/15 09:30 (external edit)