Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Check added and removed items from two different arrays
function checkArrayDifferences (array1, array2) {
"use strict";
var removed = $(array1).not(array2).get(),
added = $(array2).not(array1).get();
return {'removed': removed, 'added': added};
}
var array1 = [1,2,3,4],
array2 = [2,3,6],
differences;
differences = checkArrayDifferences(array1, array2);
window.console.log(differences);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.