Skip to content

Instantly share code, notes, and snippets.

@kitsune7
Created December 12, 2018 22:30
Show Gist options
  • Save kitsune7/1054246f225be138dc36f32d8f723125 to your computer and use it in GitHub Desktop.
Save kitsune7/1054246f225be138dc36f32d8f723125 to your computer and use it in GitHub Desktop.
Checks if two arrays are equal
/**
* @param a First array
* @param b Second array
* @returns boolean; true if a and b are equal, false otherwise
*/
function arraysEqual (a, b) {
if (a.length !== b.length) {
return false
}
for (let i = 0; i < a.length; ++i) {
if (a[i] !== b[i]) {
return false
}
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment