how to implement this extend settings function
<p>I've been trying to write an extend funtion so I can have bunch of settings in my app that can be overriden by the user by passing in a options object to the constructor.</p>

<p>I need something like below....but the problem with this code is that an object doesn't have a length property (that might not be the only thing wrong with the code below).</p>

<p>Any ideas? How do you implement this. I've had a good google and a look at the jQuery source but I can't figure how it's working:</p>

<pre><code>extend : function() {
    for(var i = 0; i &lt; options.length; ++ i) {
        if(options[i] in this.settings) {
            this.settings[options[i]] = options[i];
        }
    }
}
</code></pre>
