Best way to return early from a javascript function normally returning a reference
<p>Lets say we have a function of the form:</p>

<pre><code>function getReferenceToFoo( idName )
{
    if( ! document.getElementById( idName ) )
    {
        return;
    }
    ... 
    // else return reference to element normally
}
</code></pre>

<p>What is the best way to indicate failure by return type? By my mind I could do one of the following:</p>

<ol>
<li>Just 'Return' (as above)</li>
<li>Return 'null'</li>
<li>Return 'undefined'</li>
</ol>

<p>Which is the best practice and why?</p>
