Skip to content

Instantly share code, notes, and snippets.

@timemachine3030
Created December 3, 2010 08:08
Show Gist options
  • Save timemachine3030/726703 to your computer and use it in GitHub Desktop.
Save timemachine3030/726703 to your computer and use it in GitHub Desktop.
This is how you chain
var MyClass = function () {};
MyClass.prototype.one = function () {
console.log(1);
return this;
}
MyClass.prototype.two = function () {
console.log(2);
return this;
}
var test = new MyClass();
test.one().two().one().two()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment