Created
October 7, 2013 16:38
-
-
Save Gerjo/6870967 to your computer and use it in GitHub Desktop.
function with methods
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
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