JSFiddle - React, Tailwind, and code Playground
JavaScript
var A = {};
var B = Object.create(A);
var C = Object.create(B);
var D = Object.create({});
console.log(isInPrototypeChain(C, A));
console.log(isInPrototypeChain(D, A));
function isInPrototypeChain(topMost, itemToSearchFor) {
var p = topMost;
do {
p = Object.getPrototypeOf(p); // prototype of current
if(p === itemToSearchFor) {
return true;
}
} while(p); // while not null (after last chain)
return false;
}