Returns the difference of two arrays - Node.js Array

Node.js examples for Array:Set Operation

Description

Returns the difference of two arrays

Demo Code

Array.prototype.diff = function (B) {
    return this.filter(function (a) { return B.indexOf(a) < 0; });
};

Related Tutorials