Set a functions variables with an object's values
<p>Normally I would set a functions variables with something like this: </p>

<pre><code>var width = null;
var height = null;

if(options) {
    if(options.width) width = options.width;
    if(options.height) height = options.height;
}
</code></pre>

<p>Is there a way to simplify this with something like:</p>

<pre><code>var width = null;
var height = null;

if(options) {
    for(var val in options) {
        val = options[val];
    }
}
</code></pre>

<p>In this simple example it doesn't seem like a big benefit, but in a situation where I have a multitude of variables to set with values from a single object (in such a way that say...ajax does it), it would be much easier to just loop the object and do it that way.</p>
