Skip to content

Instantly share code, notes, and snippets.

@rodrei
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rodrei/402c096a88329e9d7b32 to your computer and use it in GitHub Desktop.
Save rodrei/402c096a88329e9d7b32 to your computer and use it in GitHub Desktop.
/*
* Creates a new object that uses the old object as its prototype
* From: Javascript: the Good Parts
*/
if (typeof Object.create !== 'function') {
Object.create = function (o) {
var F = function () {};
F.prototype = o;
return new F();
};
}
/*
*
*/
Function.prototype.method = function (name, func) {
this.prototype[name] = func;
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment