Last active
November 15, 2018 14:58
-
-
Save NullDev/cffb2a4e8f2f824b1fc49ba12bf5e06e to your computer and use it in GitHub Desktop.
Global Chain function example with prototyping
This file contains 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.test = function(x){ | |
var arg1 = this(); | |
var arg2 = x; | |
console.log( | |
"Arg1: " + arg1 + | |
"\nArg2: " + arg2 | |
); | |
} | |
function x(){ | |
return "arg1"; | |
} | |
x.test("arg2"); | |
// Should output: | |
// Arg1: arg1 | |
// Arg2: arg2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fiddle: https://jsfiddle.net/vc6kysmL/