JSFiddle - React, Tailwind, and code Playground
JavaScript
function printPrototype(obj, i) {
var n = Number(i || 0);
var indent = Array(2 + n).join("-");
for(var key in obj) {
if(obj.hasOwnProperty(key)) {
console.log(indent, key, ": ", obj[key]);
}
}
if(obj) {
if(Object.getPrototypeOf) {
printPrototype(Object.getPrototypeOf(obj), n + 1);
} else if(obj.__proto__) {
printPrototype(obj.__proto__, n + 1);
}
}
}
var A = function A() { this.a1 = "a1"; };
var B = function B() { this.b1 = "b1"; };
var C = function C() { this.c1 = "c1"; };
B.prototype = new A();
B.prototype.a2 = "a2";
C.prototype = new B();
C.prototype.b2 = "b2";
// C -> B -> A
printPrototype(new C());