Skip to content

Instantly share code, notes, and snippets.

@imskojs
Created January 10, 2019 00:24
Show Gist options
  • Save imskojs/b585d58a9dc277eed8c48499899ed808 to your computer and use it in GitHub Desktop.
Save imskojs/b585d58a9dc277eed8c48499899ed808 to your computer and use it in GitHub Desktop.
// Returns All prototypical chain of an object.
function protos(obj) {
var result = [];
function diver(obj){
if(obj.__proto__){
result.push(obj.__proto__.constructor);
} else {
result.push(null);
return false;
}
diver(obj.__proto__);
}
diver(obj);
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment