Created
April 12, 2019 19:02
-
-
Save pablocattaneo/3736d249aa4a2bafb210c1f850d6d748 to your computer and use it in GitHub Desktop.
How check if two array contains same elements in JavaScript?
Source: https://stackoverflow.com/a/49218423/3599272
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 A = [0, 1, 2], | |
B = [2, 1, 0], | |
C=[2, 1]; | |
// A.every( e => B.includes(e) ) | |
console.log(A.every(e => B.includes(e))); | |
console.log(A.every(e => C.includes(e))); | |
console.log(C.every(e => B.includes(e))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment