Created
August 10, 2014 22:48
-
-
Save shri3k/f12bb33a19e383c3ec53 to your computer and use it in GitHub Desktop.
Creating chains in js
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 Test(){ | |
this.x = "I'm x"; | |
this.publicFn = function(){ | |
console.log("I'm a instance method"); | |
} | |
} | |
Test.prototype = { | |
protoFn : function(){ | |
console.log("And I'm a proto function"); | |
return this; | |
} | |
} | |
var z = new Test(); | |
z.protoFn().publicFn(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment