Skip to content

Instantly share code, notes, and snippets.

@Williammer
Created July 3, 2014 08:28
Show Gist options
  • Select an option

  • Save Williammer/b58ba32f1337cd85e467 to your computer and use it in GitHub Desktop.

Select an option

Save Williammer/b58ba32f1337cd85e467 to your computer and use it in GitHub Desktop.
jsBasic.getPrototypeOf.js - compatible version of ES5 getPrototypeOf method to find the prototype object of an instance.
if (typeof Object.getPrototypeOf === "undefined") {
Object.getPrototypeOf = function (obj) {
var t = typeof obj;
if (!obj || (t !== "object" && t !== "function")) {
throw new TypeError("not an object");
}
return obj.__proto__;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment