Skip to content

Instantly share code, notes, and snippets.

@pthm
Created June 24, 2019 18:19
Show Gist options
  • Save pthm/a19b7eec58e6e4c36f7b31709fdc5e75 to your computer and use it in GitHub Desktop.
Save pthm/a19b7eec58e6e4c36f7b31709fdc5e75 to your computer and use it in GitHub Desktop.
multi dimensional commonality js
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