I would like to implement a builder using closures in JavaScript. I feel it can be done, but am struggling to put it into code.

I have something like this but I feel there is probably a better solution leveraging something like partial application.

```
function Builder() {
    this.spec = {};
}

Builder.prototype.withFoo = function(value) {
    this.spec.foo = value;
    return this;
};

Builder.prototype.withBar = function(value) {
    this.spec.bar = value;
    return this;
};

Builder.prototype.build = function() {
    var result = {};
    result.foo = this.spec.foo;
    result.bar = this.spec.bar;
    this.spec = {}; // This is to avoid accidentally using the same builder repeatedly.

    return result;
};

var builder = new Builder();
builder.withFoo('foo value')
       .withBar('foo value')
       .build(); // { foo: 'foo value' , bar: 'bar value' }

```

Can anyone help me do this?

**Edit:** The key thing here is that I want the object to be instantiated lazily.