var Foo = function(a) { this.baz = a; }; Foo.prototype.bar = function() { return this.baz; } alert(new Foo('Hello World').bar());