Skip to content

Instantly share code, notes, and snippets.

@dutchcelt
Last active February 11, 2024 20:37
Show Gist options
  • Select an option

  • Save dutchcelt/f5678ea955f2daee32bc to your computer and use it in GitHub Desktop.

Select an option

Save dutchcelt/f5678ea955f2daee32bc to your computer and use it in GitHub Desktop.
Object_Create
// 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