Skip to content

Instantly share code, notes, and snippets.

@rikuba
Created August 29, 2013 21:39
Show Gist options
  • Save rikuba/6383763 to your computer and use it in GitHub Desktop.
Save rikuba/6383763 to your computer and use it in GitHub Desktop.
Function.prototype.new
(function () {
var bind = Function.prototype.bind;
var slice = Array.prototype.slice;
Object.defineProperty(Function.prototype, 'new', {
value: function _new() {
return new (bind.apply(this, [null].concat(slice.call(arguments))));
},
configurable: true,
enumerable: false,
writable: true
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment