Javascript: Different return types
<p><br>
  I saw I could return different type for the same function in JS, which I am new to. Is it idiomatic, or should be discouraged. A mock example is below.</p>

<p>thanks.</p>

<p>Eg:</p>

<pre><code>somefn = function(e) {

    switch (e.type) 
    {
       case 'mousedown':
         return false;
       case 'mousemove':
         return {x:10, y:20};
    }
 };
</code></pre>
