Skip to content

Instantly share code, notes, and snippets.

@jurosh
Last active May 3, 2017 10:06
Show Gist options
  • Select an option

  • Save jurosh/0afcd0b598564f99a89565b0dad885e3 to your computer and use it in GitHub Desktop.

Select an option

Save jurosh/0afcd0b598564f99a89565b0dad885e3 to your computer and use it in GitHub Desktop.
Trace Prototype Chain (See, explore JavaScript prototype chain)
function tracePrototypeChainOf(object) {
let proto = object.constructor.prototype;
let result = '';
while (proto) {
result += ' -> ' + proto.constructor.name;
proto = Object.getPrototypeOf(proto)
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment