Created
January 10, 2019 00:24
-
-
Save imskojs/b585d58a9dc277eed8c48499899ed808 to your computer and use it in GitHub Desktop.
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
// 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