Last active
February 11, 2024 20:37
-
-
Save dutchcelt/f5678ea955f2daee32bc to your computer and use it in GitHub Desktop.
Object_Create
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
| // Object.create | |
| if (typeof Object.create != 'function') { | |
| (function () { | |
| var F = function () {}; | |
| Object.create = function (o) { | |
| if (arguments.length > 1) { throw Error('Second argument not supported');} | |
| if (o === null) { throw Error('Cannot set a null [[Prototype]]');} | |
| if (typeof o != 'object') { throw TypeError('Argument must be an object');} | |
| F.prototype = o; | |
| return new F(); | |
| }; | |
| })(); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment