Guarding against undefined parameters
<p>So I'm using an object to pass in my optional variables like so:</p>

<pre><code>var foo = function (options) {
            var options = options || {}; //provide a default, so that
            var bar = options.bar || 42; //this doesn't fail on 'foo();'
            //do stuff
        };
</code></pre>

<p>JSLint complains that I'm overwriting options, which is what I want if it's falsy. Actually, I should probably check if it's an Object and elsewise throw an error to let the user know what's up. So - on that note - what would be good form here? Anybody know a good read on this? Additionally, how would I go about writing a bunch of functions with this pattern in a DRY style?</p>
