Created
April 12, 2019 19:03
-
-
Save pablocattaneo/fc97f81e469aaf88503c06035f76eef8 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