Foo=function(){this.init()} Foo.prototype={ foo: undefined, bar: undefined, init: function(){ with(this){foo=1;bar=2} } } foo=new Foo console.log(foo)