Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Object.isAncestorOf = function isAncestorOf(parent,child) {
if (child===null || child===undefined) return false;
if (parent === null) return true;
child = Object(child);
var proto = Object.getPrototypeOf(child);
if (proto === parent) return true;
return isAncestorOf(parent,proto);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.