It is easy to find method owner in ruby:
1.method(:+).owner => Integer
Not so simple in JavaScript, here property access returns unbound function:
document.getElementsByClassName document['getElementsByClassName'] // ƒ getElementsByClassName() { [native code] }
Instead we should replicate name resolution in prototype chain — traverse from the top:
Object.prototype.propertyOwner = function (name) { if (this.hasOwnProperty(name)) { return this } return this.__proto__.propertyOwner(name) } document.propertyOwner('getElementsByTagName') // Document