function test () { var self = this; this.first = function () { alert('one'); return self; } this.second = function () { alert('two'); return self; } } var obj = new test(); obj.first().second();