Created
April 19, 2021 16:35
-
-
Save akhayoon/2e4b0c023a714b808a6c6372219604a6 to your computer and use it in GitHub Desktop.
Compare two arrays in JavaScript
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
const equalsWithStringify = (a, b) => JSON.stringify(a) === jSON.stringify(b); | |
const equalsWithEvery = (a, b) => a.lenght === b.length && a.every((v, i) => v === b[i]); | |
const a = [1, 2, 3]; | |
const b = [1, 2, 3]; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment