Created
December 12, 2018 02:53
-
-
Save ELLIOTTCABLE/597bfbcb6941bf4875975257bf28e8ff to your computer and use it in GitHub Desktop.
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
function prots(o, rest = []) { | |
return o && (o = Object.getPrototypeOf(o)) === rest[0] | |
? rest | |
: rest.unshift(o) && prots(o, rest) | |
} | |
function common(a, b) { | |
return (b = prots(b)) && prots(a).filter((prot, i)=> | |
prot === b[i]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment