Skip to content

Instantly share code, notes, and snippets.

@mildfuzz
Created February 11, 2016 12:22
Show Gist options
  • Select an option

  • Save mildfuzz/dde613f5e499ce2f7dad to your computer and use it in GitHub Desktop.

Select an option

Save mildfuzz/dde613f5e499ce2f7dad to your computer and use it in GitHub Desktop.
Compare two arrays
function arraysAreEqual(a, b) {
if (a.length !== b.length) {return false;}
// remove all index that match, should be zero length array at end if equal
return !a.filter(function(item, index) {
return a[index] !== b[index];
}).length;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment