Skip to content

Instantly share code, notes, and snippets.

@joeyred
Created March 7, 2020 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeyred/23a6d503143b414277e923beba183042 to your computer and use it in GitHub Desktop.
Save joeyred/23a6d503143b414277e923beba183042 to your computer and use it in GitHub Desktop.
function arraysMatch(arrayOne, arrayTwo) {
let match = false;
if (arrayOne.length !== arrayTwo.length) {
return false;
}
for (let indexOne = 0; indexOne < arrayOne.length; indexOne += 1) {
// For checking for a match to the current ArrayOne value
let valueMatch = false;
for (let indexTwo = 0; indexTwo < arrayTwo.length; indexTwo += 1) {
if (arrayOne[indexOne] === arrayTwo[indexTwo]) {
valueMatch = true;
break;
}
}
match = valueMatch;
}
return match;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment