Created
July 3, 2014 08:28
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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