Given the following code:
function a() {}
function b() {}
b.prototype = new a();
var b1 = new b();
We can stay that a
has been added to b
's prototype chain. Great. And, all the following are true:
b1 instanceof b
b1 instanceof a
b1 instanceof Object
My question is, what if we don't know the origins of b1
ahead of time? How can we discover the members of its prototype chain? Ideally I'd like an array like [b, a, Object]
or ["b", "a", "Object"]
.
Is this possible? I believe I've seen an answer somewhere on SO that described how to find out just this but I can't for the life of me find it again.