Javascript: Control over undefined?
<p>Maybe somehow extend try&amp;catch or errors handling to throw errors on undefined catch, only in debug mode(flag on)?</p>

<p>Because it will lessen my code and increase readability.</p>

<pre><code>if (typeof foo != 'undefined') {
 /* Do something with foo */
}
</code></pre>

<p>Instead of using it right away.</p>

<p>Same with concatenating undefined variable to a string if there any solution.</p>

<pre><code>'bar'+ ((typeof foo != 'undefined') ? foo : '') +'bar'
</code></pre>

<p>Instead of using it right away </p>

<pre><code>'bar'+ foo +'bar'
</code></pre>

<p>Thanks :)</p>

<p><strong>Update, some examples:</strong></p>

<pre><code>(function(o){
var s = {
    foo:''
}
$.extend(s,o);

console.log('testing'+ s.foo +'testing');
})();

(function(o){
console.log('testing'+ o.foo +'testing');
})({foo:''});

(function(o){
console.log('testing'+ (typeof o.foo != 'undefined' ? o.foo : '') +'testing');
})();

(function(o){
console.log('testing'+ o.foo +'testing');
})();
</code></pre>
