Created
June 24, 2019 18:19
-
-
Save pthm/a19b7eec58e6e4c36f7b31709fdc5e75 to your computer and use it in GitHub Desktop.
multi dimensional commonality js
This file contains 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
let a = [["a","b","c"],["b","c","d"],["a","b","c"]]; | |
let b = [...new Set(a.reduce((acc,v,i)=>acc.concat(v.filter(v => a.every(a => a.includes(v)))),[]))] | |
console.log(b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment