Skip to content

Instantly share code, notes, and snippets.

@Gerjo
Created October 7, 2013 16:38
Show Gist options
  • Save Gerjo/6870967 to your computer and use it in GitHub Desktop.
Save Gerjo/6870967 to your computer and use it in GitHub Desktop.
function with methods
Function.prototype.derp = function() {
console.log("derp!");
return this;
}
// A functions with methods? Sure.
var m = function () {
console.log("whoop");
}.derp(); // prints "derp!"
m(); // prints "whoop"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment