Created
December 12, 2018 22:30
-
-
Save kitsune7/1054246f225be138dc36f32d8f723125 to your computer and use it in GitHub Desktop.
Checks if two arrays are equal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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