Skip to content

Instantly share code, notes, and snippets.

@DingWeizhe
Created August 29, 2015 08:50
Show Gist options
  • Save DingWeizhe/324aca5e4a6de0ab0800 to your computer and use it in GitHub Desktop.
Save DingWeizhe/324aca5e4a6de0ab0800 to your computer and use it in GitHub Desktop.
oldList = [{a:1},{b:2},{c:3}];
currentList = [{a:1},{b:2},{c:3},{d:4}];
oldJSON = oldList.map(JSON.stringify);
newList = currentList.filter(function(obj){
return oldJSON.indexOf(JSON.stringify(obj)) == -1;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment