function Foo() { this.z = 1; this.out = function(x, y) { return x + y + this.z } } var bar = new Foo().out(2,3); // returns 6