Created
February 11, 2012 06:02
-
-
Save sanandnarayan/1796889 to your computer and use it in GitHub Desktop.
chaining 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
var chaining = function(){ | |
this.count = 1; | |
this.increment = function(){ | |
this.count++; | |
this.addition = function(v){ | |
this.count += v; | |
this.shout = function(){ | |
console.log("I am shouting dadad...." + this.count); | |
return this; | |
}; | |
return this; | |
}; | |
return this; | |
}; | |
}; | |
console.log(new chaining().increment().addition(4).shout()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment