так?
Array.prototype.compare = function(arr) {
var search = arr.slice(),
remove = [];
for(var i = 0, index; i < this.length; i++) {
index = search.indexOf(this[i]);
if(!~index) {
remove.push(this[i]);
continue;
}
delete search[index];
};
return {
remove: remove,
insert: search
}
}
console.log([1,2,3,4].compare([2,3,4,5, 34, 2 , 3434]));