Skip to content

Instantly share code, notes, and snippets.

@sanandnarayan
Created February 11, 2012 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanandnarayan/1796889 to your computer and use it in GitHub Desktop.
Save sanandnarayan/1796889 to your computer and use it in GitHub Desktop.
chaining in js
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